[libcxx-commits] [libcxx] [libc++]libcxx constexpr deque (PR #200929)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jun 1 21:13:41 PDT 2026
https://github.com/Serosh-commits updated https://github.com/llvm/llvm-project/pull/200929
>From 8ece3480db3e8038322e030e309b3d2ee87643e0 Mon Sep 17 00:00:00 2001
From: Serosh-commits <janmejayapanda400 at gmail.com>
Date: Tue, 2 Jun 2026 03:14:27 +0530
Subject: [PATCH 1/2] Implement constexpr deque
---
libcxx/docs/FeatureTestMacroTable.rst | 2 +
libcxx/docs/ReleaseNotes/21.rst | 2 +-
libcxx/include/__debug_utils/sanitizers.h | 5 +-
.../include/__memory/allocator_destructor.h | 8 +-
libcxx/include/deque | 617 +++++++++++-------
libcxx/include/version | 2 +
.../alg.fill/fill.pass.cpp | 4 +-
.../alg.fill/fill_n.pass.cpp | 4 +-
.../alg.fill/ranges.fill.pass.cpp | 4 +-
.../alg.fill/ranges.fill_n.pass.cpp | 4 +-
.../alg.foreach/for_each_n.pass.cpp | 8 +-
.../alg.foreach/ranges.for_each.pass.cpp | 8 +-
.../alg.foreach/ranges.for_each_n.pass.cpp | 8 +-
.../sequences/deque/compare.pass.cpp | 22 +
.../deque/compare.three_way.pass.cpp | 18 +-
.../deque/deque.capacity/access.pass.cpp | 18 +
.../deque/deque.capacity/empty.pass.cpp | 17 +
.../deque/deque.capacity/max_size.pass.cpp | 15 +
.../deque/deque.capacity/resize_size.pass.cpp | 18 +
.../deque.capacity/resize_size_value.pass.cpp | 16 +
.../deque.capacity/shrink_to_fit.pass.cpp | 16 +
.../deque/deque.capacity/size.pass.cpp | 15 +
.../sequences/deque/deque.cons/alloc.pass.cpp | 15 +
.../assign_initializer_list.pass.cpp | 16 +
.../deque.cons/assign_iter_iter.pass.cpp | 17 +
.../deque.cons/assign_size_value.pass.cpp | 16 +
.../sequences/deque/deque.cons/copy.pass.cpp | 16 +
.../deque/deque.cons/copy_alloc.pass.cpp | 16 +
.../deque/deque.cons/default.pass.cpp | 16 +
.../deque/deque.cons/dtor_noexcept.pass.cpp | 27 +
.../deque/deque.cons/from_range.pass.cpp | 17 +-
.../deque.cons/initializer_list.pass.cpp | 16 +
.../initializer_list_alloc.pass.cpp | 16 +
.../deque/deque.cons/iter_iter.pass.cpp | 17 +
.../deque/deque.cons/iter_iter_alloc.pass.cpp | 17 +
.../sequences/deque/deque.cons/move.pass.cpp | 16 +
.../deque/deque.cons/move_alloc.pass.cpp | 16 +
.../deque/deque.cons/move_assign.pass.cpp | 17 +
.../deque/deque.cons/op_equal.pass.cpp | 16 +
.../op_equal_initializer_list.pass.cpp | 16 +
.../sequences/deque/deque.cons/size.pass.cpp | 16 +
.../deque/deque.cons/size_value.pass.cpp | 17 +
.../deque.cons/size_value_alloc.pass.cpp | 16 +
.../deque/deque.erasure/erase.pass.cpp | 17 +
.../deque/deque.erasure/erase_if.pass.cpp | 17 +
.../deque.modifiers/append_range.pass.cpp | 19 +-
.../deque.modifiers/assign_range.pass.cpp | 19 +-
.../deque/deque.modifiers/clear.pass.cpp | 16 +
.../deque/deque.modifiers/emplace.pass.cpp | 17 +
.../deque.modifiers/emplace_back.pass.cpp | 16 +
.../deque.modifiers/emplace_front.pass.cpp | 16 +
.../deque/deque.modifiers/erase_iter.pass.cpp | 17 +
.../deque.modifiers/erase_iter_iter.pass.cpp | 17 +
.../insert_iter_initializer_list.pass.cpp | 17 +
.../deque.modifiers/insert_iter_iter.pass.cpp | 18 +
.../deque.modifiers/insert_range.pass.cpp | 20 +-
.../deque.modifiers/insert_rvalue.pass.cpp | 18 +
.../insert_size_value.pass.cpp | 17 +
.../deque.modifiers/insert_value.pass.cpp | 17 +
.../deque/deque.modifiers/pop_back.pass.cpp | 16 +
.../deque/deque.modifiers/pop_front.pass.cpp | 16 +
.../deque.modifiers/prepend_range.pass.cpp | 19 +-
.../deque/deque.modifiers/push_back.pass.cpp | 17 +
.../deque.modifiers/push_back_rvalue.pass.cpp | 17 +
.../deque/deque.modifiers/push_front.pass.cpp | 17 +
.../push_front_rvalue.pass.cpp | 17 +
.../deque/deque.special/swap.pass.cpp | 18 +
.../sequences/deque/get_allocator.pass.cpp | 15 +
.../sequences/deque/iterators.pass.cpp | 19 +
.../iterator.operations/distance.pass.cpp | 4 +-
.../iterator_sentinel.pass.cpp | 4 +-
.../deque.version.compile.pass.cpp | 27 +
.../version.version.compile.pass.cpp | 27 +
.../generate_feature_test_macro_components.py | 5 +
74 files changed, 1410 insertions(+), 289 deletions(-)
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index ae48eaed1f46b..ae7f68832d00d 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -436,6 +436,8 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_constexpr_algorithms`` ``202306L``
---------------------------------------------------------- -----------------
+ ``__cpp_lib_constexpr_deque`` ``202502L``
+ ---------------------------------------------------------- -----------------
``__cpp_lib_constexpr_flat_map`` ``202502L``
---------------------------------------------------------- -----------------
``__cpp_lib_constexpr_flat_set`` ``202502L``
diff --git a/libcxx/docs/ReleaseNotes/21.rst b/libcxx/docs/ReleaseNotes/21.rst
index 2b1aa28b62090..5c0d05365a30a 100644
--- a/libcxx/docs/ReleaseNotes/21.rst
+++ b/libcxx/docs/ReleaseNotes/21.rst
@@ -48,7 +48,7 @@ Implemented Papers
- P1222R4: A Standard ``flat_set`` (`Github <https://github.com/llvm/llvm-project/issues/105193>`__)
- P2897R7: ``aligned_accessor``: An mdspan accessor expressing pointer over-alignment (`Github <https://github.com/llvm/llvm-project/issues/118372>`__)
- P3247R2: Deprecate the notion of trivial types (`Github <https://github.com/llvm/llvm-project/issues/118387>`__)
-- P3372R3: ``constexpr`` containers and adaptors (`Github <https://github.com/llvm/llvm-project/issues/127876>`__) (``forward_list``, ``list``, ``priority_queue``, ``flat_map``, and ``flat_set`` are implemented)
+- P3372R3: ``constexpr`` containers and adaptors (`Github <https://github.com/llvm/llvm-project/issues/127876>`__) (``deque``, ``forward_list``, ``list``, ``priority_queue``, ``flat_map``, and ``flat_set`` are implemented)
- P2441R2: ``views::join_with`` (`Github <https://github.com/llvm/llvm-project/issues/105185>`__)
- P2711R1: Making multi-param constructors of ``views`` ``explicit`` (`Github <https://github.com/llvm/llvm-project/issues/105252>`__)
- P2770R0: Stashing stashing ``iterators`` for proper flattening (`Github <https://github.com/llvm/llvm-project/issues/105250>`__)
diff --git a/libcxx/include/__debug_utils/sanitizers.h b/libcxx/include/__debug_utils/sanitizers.h
index e35812cc440d7..cb923fb666f3e 100644
--- a/libcxx/include/__debug_utils/sanitizers.h
+++ b/libcxx/include/__debug_utils/sanitizers.h
@@ -75,7 +75,7 @@ struct __asan_annotate_container_with_allocator : true_type {};
// - [__first_old_contained, __last_old_contained) is the previously allowed (unpoisoned) range, and
// - [__first_new_contained, __last_new_contained) is the new allowed (unpoisoned) range.
template <class _Allocator>
-_LIBCPP_HIDE_FROM_ABI void __annotate_double_ended_contiguous_container(
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __annotate_double_ended_contiguous_container(
const void* __first_storage,
const void* __last_storage,
const void* __first_old_contained,
@@ -90,7 +90,8 @@ _LIBCPP_HIDE_FROM_ABI void __annotate_double_ended_contiguous_container(
(void)__first_new_contained;
(void)__last_new_contained;
#else
- if (__asan_annotate_container_with_allocator<_Allocator>::value && __first_storage != nullptr)
+ if (!__libcpp_is_constant_evaluated() && __asan_annotate_container_with_allocator<_Allocator>::value &&
+ __first_storage != nullptr)
__sanitizer_annotate_double_ended_contiguous_container(
__first_storage,
__last_storage,
diff --git a/libcxx/include/__memory/allocator_destructor.h b/libcxx/include/__memory/allocator_destructor.h
index aac92a23fa0d4..211178004d672 100644
--- a/libcxx/include/__memory/allocator_destructor.h
+++ b/libcxx/include/__memory/allocator_destructor.h
@@ -31,8 +31,12 @@ class __allocator_destructor {
size_type __s_;
public:
- _LIBCPP_HIDE_FROM_ABI __allocator_destructor(_Alloc& __a, size_type __s) _NOEXCEPT : __alloc_(__a), __s_(__s) {}
- _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT { __alloc_traits::deallocate(__alloc_, __p, __s_); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __allocator_destructor(_Alloc& __a, size_type __s) _NOEXCEPT
+ : __alloc_(__a),
+ __s_(__s) {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
+ __alloc_traits::deallocate(__alloc_, __p, __s_);
+ }
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/deque b/libcxx/include/deque
index c8c6889f1a165..319c494bc01f1 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -234,6 +234,7 @@ template <class T, class Allocator, class Predicate>
# include <__type_traits/type_identity.h>
# include <__utility/exception_guard.h>
# include <__utility/forward.h>
+# include <__utility/is_pointer_in_range.h>
# include <__utility/move.h>
# include <__utility/pair.h>
# include <__utility/swap.h>
@@ -311,7 +312,7 @@ public:
typedef random_access_iterator_tag iterator_category;
typedef _Reference reference;
- _LIBCPP_HIDE_FROM_ABI __deque_iterator() _NOEXCEPT
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_iterator() _NOEXCEPT
# if _LIBCPP_STD_VER >= 14
: __m_iter_(nullptr),
__ptr_(nullptr)
@@ -320,15 +321,15 @@ public:
}
template <class _Pp, class _Rp, class _MP, __enable_if_t<is_convertible<_Pp, pointer>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
__deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, _BS>& __it) _NOEXCEPT
: __m_iter_(__it.__m_iter_),
__ptr_(__it.__ptr_) {}
- _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *__ptr_; }
- _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return __ptr_; }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference operator*() const { return *__ptr_; }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI pointer operator->() const { return __ptr_; }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator++() {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator++() {
if (++__ptr_ - *__m_iter_ == __block_size) {
++__m_iter_;
__ptr_ = *__m_iter_;
@@ -336,13 +337,13 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI __deque_iterator operator++(int) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_iterator operator++(int) {
__deque_iterator __tmp = *this;
++(*this);
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator--() {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator--() {
if (__ptr_ == *__m_iter_) {
--__m_iter_;
__ptr_ = *__m_iter_ + __block_size;
@@ -351,13 +352,13 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI __deque_iterator operator--(int) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_iterator operator--(int) {
__deque_iterator __tmp = *this;
--(*this);
return __tmp;
}
- _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator+=(difference_type __n) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator+=(difference_type __n) {
if (__n != 0) {
__n += __ptr_ - *__m_iter_;
if (__n > 0) {
@@ -373,60 +374,73 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator-=(difference_type __n) { return *this += -__n; }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_iterator& operator-=(difference_type __n) {
+ return *this += -__n;
+ }
- _LIBCPP_HIDE_FROM_ABI __deque_iterator operator+(difference_type __n) const {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_iterator operator+(difference_type __n) const {
__deque_iterator __t(*this);
__t += __n;
return __t;
}
- _LIBCPP_HIDE_FROM_ABI __deque_iterator operator-(difference_type __n) const {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_iterator operator-(difference_type __n) const {
__deque_iterator __t(*this);
__t -= __n;
return __t;
}
- _LIBCPP_HIDE_FROM_ABI friend __deque_iterator operator+(difference_type __n, const __deque_iterator& __it) {
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_iterator
+ operator+(difference_type __n, const __deque_iterator& __it) {
return __it + __n;
}
- _LIBCPP_HIDE_FROM_ABI friend difference_type operator-(const __deque_iterator& __x, const __deque_iterator& __y) {
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI difference_type
+ operator-(const __deque_iterator& __x, const __deque_iterator& __y) {
if (__x != __y)
return (__x.__m_iter_ - __y.__m_iter_) * __block_size + (__x.__ptr_ - *__x.__m_iter_) -
(__y.__ptr_ - *__y.__m_iter_);
return 0;
}
- _LIBCPP_HIDE_FROM_ABI reference operator[](difference_type __n) const { return *(*this + __n); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference operator[](difference_type __n) const {
+ return *(*this + __n);
+ }
- _LIBCPP_HIDE_FROM_ABI friend bool operator==(const __deque_iterator& __x, const __deque_iterator& __y) {
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool
+ operator==(const __deque_iterator& __x, const __deque_iterator& __y) {
return __x.__ptr_ == __y.__ptr_;
}
# if _LIBCPP_STD_VER <= 17
- _LIBCPP_HIDE_FROM_ABI friend bool operator!=(const __deque_iterator& __x, const __deque_iterator& __y) {
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX26
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const __deque_iterator& __x, const __deque_iterator& __y) {
return !(__x == __y);
}
- _LIBCPP_HIDE_FROM_ABI friend bool operator<(const __deque_iterator& __x, const __deque_iterator& __y) {
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool
+ operator<(const __deque_iterator& __x, const __deque_iterator& __y) {
return __x.__m_iter_ < __y.__m_iter_ || (__x.__m_iter_ == __y.__m_iter_ && __x.__ptr_ < __y.__ptr_);
}
- _LIBCPP_HIDE_FROM_ABI friend bool operator>(const __deque_iterator& __x, const __deque_iterator& __y) {
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool
+ operator>(const __deque_iterator& __x, const __deque_iterator& __y) {
return __y < __x;
}
- _LIBCPP_HIDE_FROM_ABI friend bool operator<=(const __deque_iterator& __x, const __deque_iterator& __y) {
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool
+ operator<=(const __deque_iterator& __x, const __deque_iterator& __y) {
return !(__y < __x);
}
- _LIBCPP_HIDE_FROM_ABI friend bool operator>=(const __deque_iterator& __x, const __deque_iterator& __y) {
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool
+ operator>=(const __deque_iterator& __x, const __deque_iterator& __y) {
return !(__x < __y);
}
# else
- _LIBCPP_HIDE_FROM_ABI friend strong_ordering operator<=>(const __deque_iterator& __x, const __deque_iterator& __y) {
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX26
+ _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const __deque_iterator& __x, const __deque_iterator& __y) {
if (__x.__m_iter_ < __y.__m_iter_)
return strong_ordering::less;
@@ -449,6 +463,7 @@ public:
# endif // _LIBCPP_STD_VER >= 20
private:
+ _LIBCPP_CONSTEXPR_SINCE_CXX26
_LIBCPP_HIDE_FROM_ABI explicit __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
: __m_iter_(__m),
__ptr_(__p) {}
@@ -473,15 +488,22 @@ public:
using __segment_iterator _LIBCPP_NODEBUG = typename _Iterator::__map_iterator;
using __local_iterator _LIBCPP_NODEBUG = _Pointer;
- static _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_Iterator __iter) { return __iter.__m_iter_; }
- static _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_Iterator __iter) { return __iter.__ptr_; }
- static _LIBCPP_HIDE_FROM_ABI __local_iterator __begin(__segment_iterator __iter) { return *__iter; }
+ static _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __segment_iterator __segment(_Iterator __iter) {
+ return __iter.__m_iter_;
+ }
+ static _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __local_iterator __local(_Iterator __iter) {
+ return __iter.__ptr_;
+ }
+ static _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __local_iterator __begin(__segment_iterator __iter) {
+ return *__iter;
+ }
- static _LIBCPP_HIDE_FROM_ABI __local_iterator __end(__segment_iterator __iter) {
+ static _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __local_iterator __end(__segment_iterator __iter) {
return *__iter + _Iterator::__block_size;
}
- static _LIBCPP_HIDE_FROM_ABI _Iterator __compose(__segment_iterator __segment, __local_iterator __local) {
+ static _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI _Iterator
+ __compose(__segment_iterator __segment, __local_iterator __local) {
if (__segment && __local == __end(__segment)) {
++__segment;
return _Iterator(__segment, *__segment);
@@ -552,7 +574,7 @@ public:
private:
struct __deque_block_range {
- explicit _LIBCPP_HIDE_FROM_ABI __deque_block_range(pointer __b, pointer __e) _NOEXCEPT
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit __deque_block_range(pointer __b, pointer __e) _NOEXCEPT
: __begin_(__b),
__end_(__e) {}
const pointer __begin_;
@@ -563,21 +585,27 @@ private:
iterator __pos_;
const iterator __end_;
- _LIBCPP_HIDE_FROM_ABI __deque_range(iterator __pos, iterator __e) _NOEXCEPT : __pos_(__pos), __end_(__e) {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_range(iterator __pos, iterator __e) _NOEXCEPT
+ : __pos_(__pos),
+ __end_(__e) {}
- explicit _LIBCPP_HIDE_FROM_ABI operator bool() const _NOEXCEPT { return __pos_ != __end_; }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT {
+ return __pos_ != __end_;
+ }
- _LIBCPP_HIDE_FROM_ABI __deque_range begin() const { return *this; }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_range begin() const { return *this; }
- _LIBCPP_HIDE_FROM_ABI __deque_range end() const { return __deque_range(__end_, __end_); }
- _LIBCPP_HIDE_FROM_ABI __deque_block_range operator*() const _NOEXCEPT {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_range end() const {
+ return __deque_range(__end_, __end_);
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_block_range operator*() const _NOEXCEPT {
if (__pos_.__m_iter_ == __end_.__m_iter_) {
return __deque_block_range(__pos_.__ptr_, __end_.__ptr_);
}
return __deque_block_range(__pos_.__ptr_, *__pos_.__m_iter_ + __block_size);
}
- _LIBCPP_HIDE_FROM_ABI __deque_range& operator++() _NOEXCEPT {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __deque_range& operator++() _NOEXCEPT {
if (__pos_.__m_iter_ == __end_.__m_iter_) {
__pos_ = __end_;
} else {
@@ -587,19 +615,23 @@ private:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI friend bool operator==(__deque_range const& __lhs, __deque_range const& __rhs) {
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool
+ operator==(__deque_range const& __lhs, __deque_range const& __rhs) {
return __lhs.__pos_ == __rhs.__pos_;
}
- _LIBCPP_HIDE_FROM_ABI friend bool operator!=(__deque_range const& __lhs, __deque_range const& __rhs) {
+ friend _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool
+ operator!=(__deque_range const& __lhs, __deque_range const& __rhs) {
return !(__lhs == __rhs);
}
};
struct _ConstructTransaction {
- _LIBCPP_HIDE_FROM_ABI _ConstructTransaction(deque* __db, __deque_block_range& __r)
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI _ConstructTransaction(deque* __db, __deque_block_range& __r)
: __pos_(__r.__begin_), __end_(__r.__end_), __begin_(__r.__begin_), __base_(__db) {}
- _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { __base_->__size() += (__pos_ - __begin_); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() {
+ __base_->__size() += (__pos_ - __begin_);
+ }
pointer __pos_;
const pointer __end_;
@@ -617,12 +649,13 @@ private:
public:
// construct/copy/destroy:
- _LIBCPP_HIDE_FROM_ABI deque() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI deque()
+ _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __start_(0), __size_(0) {
__annotate_new(0);
}
- _LIBCPP_HIDE_FROM_ABI ~deque() {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI ~deque() {
clear();
__annotate_delete();
typename __map::iterator __i = __map_.begin();
@@ -631,19 +664,20 @@ public:
__alloc_traits::deallocate(__alloc(), *__i, __block_size);
}
- _LIBCPP_HIDE_FROM_ABI explicit deque(const allocator_type& __a)
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit deque(const allocator_type& __a)
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) {
__annotate_new(0);
}
- explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit deque(size_type __n);
# if _LIBCPP_STD_VER >= 14
- explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const _Allocator& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit deque(size_type __n, const _Allocator& __a);
# endif
- _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v);
template <__enable_if_t<__is_allocator_v<_Allocator>, int> = 0>
- _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v, const allocator_type& __a)
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
+ deque(size_type __n, const value_type& __v, const allocator_type& __a)
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) {
__annotate_new(0);
if (__n > 0)
@@ -651,13 +685,14 @@ public:
}
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l);
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l, const allocator_type& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI deque(_InputIter __f, _InputIter __l, const allocator_type& __a);
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI deque(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
+ _LIBCPP_CONSTEXPR_SINCE_CXX26
+ _LIBCPP_HIDE_FROM_ABI deque(from_range_t, _Range&& __range, const allocator_type& __a = allocator_type())
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) {
if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
__append_with_size(ranges::begin(__range), ranges::distance(__range));
@@ -670,41 +705,46 @@ public:
}
# endif
- _LIBCPP_HIDE_FROM_ABI deque(const deque& __c);
- _LIBCPP_HIDE_FROM_ABI deque(const deque& __c, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI deque(const deque& __c);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
+ deque(const deque& __c, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI deque& operator=(const deque& __c);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI deque& operator=(const deque& __c);
# ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI deque(initializer_list<value_type> __il);
- _LIBCPP_HIDE_FROM_ABI deque(initializer_list<value_type> __il, const allocator_type& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI deque(initializer_list<value_type> __il);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
+ deque(initializer_list<value_type> __il, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI deque& operator=(initializer_list<value_type> __il) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI deque& operator=(initializer_list<value_type> __il) {
assign(__il);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI deque(deque&& __c) noexcept(is_nothrow_move_constructible<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI deque(deque&& __c, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI deque& operator=(deque&& __c) noexcept(
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
+ deque(deque&& __c) noexcept(is_nothrow_move_constructible<allocator_type>::value);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI deque(deque&& __c, const __type_identity_t<allocator_type>& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI deque& operator=(deque&& __c) noexcept(
(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
__alloc_traits::is_always_equal::value);
- _LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il) { assign(__il.begin(), __il.end()); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il) {
+ assign(__il.begin(), __il.end());
+ }
# endif // _LIBCPP_CXX03_LANG
template <class _InputIter,
__enable_if_t<__has_input_iterator_category<_InputIter>::value &&
!__has_random_access_iterator_category<_InputIter>::value,
int> = 0>
- _LIBCPP_HIDE_FROM_ABI void assign(_InputIter __f, _InputIter __l);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void assign(_InputIter __f, _InputIter __l);
template <class _RAIter, __enable_if_t<__has_random_access_iterator_category<_RAIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void assign(_RAIter __f, _RAIter __l);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void assign(_RAIter __f, _RAIter __l);
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI void assign_range(_Range&& __range) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void assign_range(_Range&& __range) {
if constexpr (ranges::random_access_range<_Range>) {
auto __n = static_cast<size_type>(ranges::distance(__range));
__assign_with_size_random_access(ranges::begin(__range), __n);
@@ -727,114 +767,131 @@ public:
}
# endif
- _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void assign(size_type __n, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return __alloc_; }
- _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT { return __alloc_; }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI allocator_type& __alloc() _NOEXCEPT { return __alloc_; }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const allocator_type& __alloc() const _NOEXCEPT {
+ return __alloc_;
+ }
// iterators:
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {
auto __mp = __map_.begin() + __start_ / __block_size;
return iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {
auto __mp = __map_.begin() + __start_ / __block_size;
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {
size_type __p = size() + __start_;
auto __mp = __map_.begin() + __p / __block_size;
return iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {
size_type __p = size() + __start_;
auto __mp = __map_.begin() + __p / __block_size;
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator
+ rbegin() const _NOEXCEPT {
return const_reverse_iterator(end());
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
return const_reverse_iterator(begin());
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT {
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT {
+ return begin();
+ }
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT {
+ return end();
+ }
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator
+ crbegin() const _NOEXCEPT {
return const_reverse_iterator(end());
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT {
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT {
return const_reverse_iterator(begin());
}
// capacity:
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size(); }
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT {
+ return __size();
+ }
- _LIBCPP_HIDE_FROM_ABI size_type& __size() _NOEXCEPT { return __size_; }
- _LIBCPP_HIDE_FROM_ABI const size_type& __size() const _NOEXCEPT { return __size_; }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type& __size() _NOEXCEPT { return __size_; }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const size_type& __size() const _NOEXCEPT { return __size_; }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT {
return std::min<size_type>(__alloc_traits::max_size(__alloc()), numeric_limits<difference_type>::max());
}
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT;
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return size() == 0; }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void resize(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void resize(size_type __n, const value_type& __v);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT;
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT {
+ return size() == 0;
+ }
// element access:
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __i) _NOEXCEPT;
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __i) const _NOEXCEPT;
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reference at(size_type __i);
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __i) const;
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT;
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT;
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT;
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT;
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference operator[](size_type __i) _NOEXCEPT;
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference
+ operator[](size_type __i) const _NOEXCEPT;
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference at(size_type __i);
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference at(size_type __i) const;
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT;
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT;
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT;
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT;
// 23.2.2.3 modifiers:
- _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI void push_back(const value_type& __v);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void push_back(const value_type& __v);
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator __emplace(const_iterator __p, _Args&&... __args);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator __emplace(const_iterator __p, _Args&&... __args);
# ifndef _LIBCPP_CXX03_LANG
# if _LIBCPP_STD_VER >= 17
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args);
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI reference emplace_back(_Args&&... __args);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI reference emplace_back(_Args&&... __args);
# else
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void emplace_front(_Args&&... __args);
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args);
# endif
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator emplace(const_iterator __p, _Args&&... __args) {
return __emplace(__p, std::forward<_Args>(__args)...);
}
- _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __v);
- _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __v);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __v);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __v);
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI void prepend_range(_Range&& __range) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void prepend_range(_Range&& __range) {
insert_range(begin(), std::forward<_Range>(__range));
}
template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI void append_range(_Range&& __range) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void append_range(_Range&& __range) {
if constexpr (ranges::forward_range<_Range> || ranges::sized_range<_Range>) {
__append_with_size(ranges::begin(__range), ranges::distance(__range));
} else {
@@ -843,25 +900,34 @@ public:
}
# endif
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) { return __emplace(__p, std::move(__v)); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
+ return __emplace(__p, std::move(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, initializer_list<value_type> __il) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator
+ insert(const_iterator __p, initializer_list<value_type> __il) {
return insert(__p, __il.begin(), __il.end());
}
# endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) { return __emplace(__p, __v); }
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, size_type __n, const value_type& __v);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
+ return __emplace(__p, __v);
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator
+ insert(const_iterator __p, size_type __n, const value_type& __v);
template <class _InputIter, __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _InputIter __f, _InputIter __l);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator
+ insert(const_iterator __p, _InputIter __f, _InputIter __l);
template <class _ForwardIterator,
__enable_if_t<__has_exactly_forward_iterator_category<_ForwardIterator>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator
+ insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l);
template <class _BiIter, __enable_if_t<__has_bidirectional_iterator_category<_BiIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _BiIter __f, _BiIter __l);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, _BiIter __f, _BiIter __l);
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI iterator insert_range(const_iterator __position, _Range&& __range) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26
+ _LIBCPP_HIDE_FROM_ABI iterator insert_range(const_iterator __position, _Range&& __range) {
if constexpr (ranges::bidirectional_range<_Range>) {
auto __n = static_cast<size_type>(ranges::distance(__range));
return __insert_bidirectional(__position, ranges::begin(__range), ranges::end(__range), __n);
@@ -876,20 +942,20 @@ public:
}
# endif
- _LIBCPP_HIDE_FROM_ABI void pop_front();
- _LIBCPP_HIDE_FROM_ABI void pop_back();
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void pop_front();
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void pop_back();
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l);
- _LIBCPP_HIDE_FROM_ABI void swap(deque& __c)
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void swap(deque& __c)
# if _LIBCPP_STD_VER >= 14
_NOEXCEPT;
# else
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>);
# endif
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI bool __invariants() const {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool __invariants() const {
if (!__map_.__invariants())
return false;
if (__map_.size() >= size_type(-1) / __block_size)
@@ -911,20 +977,20 @@ public:
return true;
}
- _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(deque& __c)
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(deque& __c)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_move_assignment::value ||
is_nothrow_move_assignable<allocator_type>::value) {
__move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
}
- _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(deque& __c, true_type)
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(deque& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
__alloc() = std::move(__c.__alloc());
}
- _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(deque&, false_type) _NOEXCEPT {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(deque&, false_type) _NOEXCEPT {}
- _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c)
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c)
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value&&
is_nothrow_move_assignable<allocator_type>::value) {
__map_ = std::move(__c.__map_);
@@ -934,18 +1000,24 @@ public:
__c.__start_ = __c.__size() = 0;
}
- _LIBCPP_HIDE_FROM_ABI static size_type __recommend_blocks(size_type __n) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI static size_type __recommend_blocks(size_type __n) {
return __n / __block_size + (__n % __block_size != 0);
}
- _LIBCPP_HIDE_FROM_ABI size_type __capacity() const {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type __capacity() const {
return __map_.size() == 0 ? 0 : __map_.size() * __block_size - 1;
}
- _LIBCPP_HIDE_FROM_ABI size_type __block_count() const { return __map_.size(); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type __block_count() const { return __map_.size(); }
- _LIBCPP_HIDE_FROM_ABI size_type __front_spare() const { return __start_; }
- _LIBCPP_HIDE_FROM_ABI size_type __front_spare_blocks() const { return __front_spare() / __block_size; }
- _LIBCPP_HIDE_FROM_ABI size_type __back_spare() const { return __capacity() - (__start_ + size()); }
- _LIBCPP_HIDE_FROM_ABI size_type __back_spare_blocks() const { return __back_spare() / __block_size; }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type __front_spare() const { return __start_; }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type __front_spare_blocks() const {
+ return __front_spare() / __block_size;
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type __back_spare() const {
+ return __capacity() - (__start_ + size());
+ }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type __back_spare_blocks() const {
+ return __back_spare() / __block_size;
+ }
private:
enum __asan_annotation_type { __asan_unposion, __asan_poison };
@@ -955,7 +1027,7 @@ private:
__asan_back_moved,
};
- _LIBCPP_HIDE_FROM_ABI void __annotate_from_to(
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __annotate_from_to(
size_type __beg,
size_type __end,
__asan_annotation_type __annotation_type,
@@ -1060,7 +1132,7 @@ private:
# endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
}
- _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT {
(void)__current_size;
# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
if (__current_size == 0)
@@ -1072,7 +1144,7 @@ private:
# endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
}
- _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT {
# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
if (empty()) {
for (size_t __i = 0; __i < __map_.size(); ++__i) {
@@ -1085,21 +1157,22 @@ private:
# endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
}
- _LIBCPP_HIDE_FROM_ABI void __annotate_increase_front(size_type __n) const _NOEXCEPT {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __annotate_increase_front(size_type __n) const _NOEXCEPT {
(void)__n;
# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
__annotate_from_to(__start_ - __n, __start_, __asan_unposion, __asan_front_moved);
# endif
}
- _LIBCPP_HIDE_FROM_ABI void __annotate_increase_back(size_type __n) const _NOEXCEPT {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __annotate_increase_back(size_type __n) const _NOEXCEPT {
(void)__n;
# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
__annotate_from_to(__start_ + size(), __start_ + size() + __n, __asan_unposion, __asan_back_moved);
# endif
}
- _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_front(size_type __old_size, size_type __old_start) const _NOEXCEPT {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void
+ __annotate_shrink_front(size_type __old_size, size_type __old_start) const _NOEXCEPT {
(void)__old_size;
(void)__old_start;
# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
@@ -1107,7 +1180,8 @@ private:
# endif
}
- _LIBCPP_HIDE_FROM_ABI void __annotate_shrink_back(size_type __old_size, size_type __old_start) const _NOEXCEPT {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void
+ __annotate_shrink_back(size_type __old_size, size_type __old_start) const _NOEXCEPT {
(void)__old_size;
(void)__old_start;
# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
@@ -1115,11 +1189,12 @@ private:
# endif
}
- _LIBCPP_HIDE_FROM_ABI void __annotate_poison_block(const void* __beginning, const void* __end) const _NOEXCEPT {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void
+ __annotate_poison_block(const void* __beginning, const void* __end) const _NOEXCEPT {
std::__annotate_double_ended_contiguous_container<_Allocator>(__beginning, __end, __beginning, __end, __end, __end);
}
- _LIBCPP_HIDE_FROM_ABI void
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void
__annotate_whole_block(size_t __block_index, __asan_annotation_type __annotation_type) const _NOEXCEPT {
(void)__block_index;
(void)__annotation_type;
@@ -1139,7 +1214,7 @@ private:
# if _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
public:
- _LIBCPP_HIDE_FROM_ABI bool __verify_asan_annotations() const _NOEXCEPT {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool __verify_asan_annotations() const _NOEXCEPT {
// This function tests deque object annotations.
if (empty()) {
for (__map_const_iterator __it = __map_.begin(); __it != __map_.end(); ++__it) {
@@ -1199,7 +1274,7 @@ public:
private:
# endif // _LIBCPP_ENABLE_ASAN_CONTAINER_CHECKS
- _LIBCPP_HIDE_FROM_ABI bool __maybe_remove_front_spare(bool __keep_one = true) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool __maybe_remove_front_spare(bool __keep_one = true) {
if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) {
__annotate_whole_block(0, __asan_unposion);
__alloc_traits::deallocate(__alloc(), __map_.front(), __block_size);
@@ -1210,7 +1285,7 @@ private:
return false;
}
- _LIBCPP_HIDE_FROM_ABI bool __maybe_remove_back_spare(bool __keep_one = true) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool __maybe_remove_back_spare(bool __keep_one = true) {
if (__back_spare_blocks() >= 2 || (!__keep_one && __back_spare_blocks())) {
__annotate_whole_block(__map_.size() - 1, __asan_unposion);
__alloc_traits::deallocate(__alloc(), __map_.back(), __block_size);
@@ -1221,54 +1296,60 @@ private:
}
template <class _Iterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iterator __f, _Sentinel __l);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __assign_with_sentinel(_Iterator __f, _Sentinel __l);
template <class _RandomAccessIterator>
- _LIBCPP_HIDE_FROM_ABI void __assign_with_size_random_access(_RandomAccessIterator __f, difference_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void
+ __assign_with_size_random_access(_RandomAccessIterator __f, difference_type __n);
template <class _AlgPolicy, class _Iterator>
- _LIBCPP_HIDE_FROM_ABI void __assign_with_size(_Iterator __f, difference_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __assign_with_size(_Iterator __f, difference_type __n);
template <class _Iterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI iterator __insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator
+ __insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l);
template <class _Iterator>
- _LIBCPP_HIDE_FROM_ABI iterator __insert_with_size(const_iterator __p, _Iterator __f, size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator
+ __insert_with_size(const_iterator __p, _Iterator __f, size_type __n);
template <class _BiIter, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI iterator
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator
__insert_bidirectional(const_iterator __p, _BiIter __f, _Sentinel __sent, size_type __n);
template <class _BiIter>
- _LIBCPP_HIDE_FROM_ABI iterator __insert_bidirectional(const_iterator __p, _BiIter __f, _BiIter __l, size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator
+ __insert_bidirectional(const_iterator __p, _BiIter __f, _BiIter __l, size_type __n);
template <class _InpIter, __enable_if_t<__has_exactly_input_iterator_category<_InpIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void __append(_InpIter __f, _InpIter __l);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __append(_InpIter __f, _InpIter __l);
template <class _ForIter, __enable_if_t<__has_forward_iterator_category<_ForIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI void __append(_ForIter __f, _ForIter __l);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __append(_ForIter __f, _ForIter __l);
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void __append_with_size(_InputIterator __from, size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __append_with_size(_InputIterator __from, size_type __n);
template <class _InputIterator, class _Sentinel>
- _LIBCPP_HIDE_FROM_ABI void __append_with_sentinel(_InputIterator __f, _Sentinel __l);
-
- _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const value_type& __v);
- _LIBCPP_HIDE_FROM_ABI void __erase_to_end(const_iterator __f);
- _LIBCPP_HIDE_FROM_ABI void __add_front_capacity();
- _LIBCPP_HIDE_FROM_ABI void __add_front_capacity(size_type __n);
- _LIBCPP_HIDE_FROM_ABI void __add_back_capacity();
- _LIBCPP_HIDE_FROM_ABI void __add_back_capacity(size_type __n);
- _LIBCPP_HIDE_FROM_ABI iterator __move_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
- _LIBCPP_HIDE_FROM_ABI iterator
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __append_with_sentinel(_InputIterator __f, _Sentinel __l);
+
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __append(size_type __n, const value_type& __v);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __erase_to_end(const_iterator __f);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __add_front_capacity();
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __add_front_capacity(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __add_back_capacity();
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __add_back_capacity(size_type __n);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator
+ __move_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI iterator
__move_backward_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
- _LIBCPP_HIDE_FROM_ABI void __move_construct_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
- _LIBCPP_HIDE_FROM_ABI void
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void
+ __move_construct_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void
__move_construct_backward_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt);
- _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const deque& __c) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const deque& __c) {
__copy_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_copy_assignment::value>());
}
- _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const deque& __c, true_type) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const deque& __c, true_type) {
if (__alloc() != __c.__alloc()) {
clear();
shrink_to_fit();
@@ -1277,11 +1358,11 @@ private:
__map_.__get_allocator() = __c.__map_.__get_allocator();
}
- _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const deque&, false_type) {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const deque&, false_type) {}
- _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, true_type)
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
- _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, false_type);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void __move_assign(deque& __c, false_type);
};
template <class _Tp, class _Alloc>
@@ -1310,7 +1391,7 @@ deque(from_range_t, _Range&&, _Alloc = _Alloc()) -> deque<ranges::range_value_t<
# endif
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>::deque(size_type __n) : __start_(0), __size_(0) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 deque<_Tp, _Allocator>::deque(size_type __n) : __start_(0), __size_(0) {
__annotate_new(0);
if (__n > 0)
__append(__n);
@@ -1318,7 +1399,7 @@ deque<_Tp, _Allocator>::deque(size_type __n) : __start_(0), __size_(0) {
# if _LIBCPP_STD_VER >= 14
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a)
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) {
__annotate_new(0);
if (__n > 0)
@@ -1327,7 +1408,8 @@ deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a)
# endif
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) : __start_(0), __size_(0) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v)
+ : __start_(0), __size_(0) {
__annotate_new(0);
if (__n > 0)
__append(__n, __v);
@@ -1335,21 +1417,21 @@ deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v) : __start_(0
template <class _Tp, class _Allocator>
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> >
-deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l) : __start_(0), __size_(0) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l) : __start_(0), __size_(0) {
__annotate_new(0);
__append(__f, __l);
}
template <class _Tp, class _Allocator>
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> >
-deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, const allocator_type& __a)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 deque<_Tp, _Allocator>::deque(_InputIter __f, _InputIter __l, const allocator_type& __a)
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) {
__annotate_new(0);
__append(__f, __l);
}
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>::deque(const deque& __c)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 deque<_Tp, _Allocator>::deque(const deque& __c)
: __map_(__pointer_allocator(__alloc_traits::select_on_container_copy_construction(__c.__alloc()))),
__start_(0),
__size_(0),
@@ -1359,6 +1441,7 @@ deque<_Tp, _Allocator>::deque(const deque& __c)
}
template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX26
deque<_Tp, _Allocator>::deque(const deque& __c, const __type_identity_t<allocator_type>& __a)
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) {
__annotate_new(0);
@@ -1366,7 +1449,7 @@ deque<_Tp, _Allocator>::deque(const deque& __c, const __type_identity_t<allocato
}
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(const deque& __c) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(const deque& __c) {
if (this != std::addressof(__c)) {
__copy_assign_alloc(__c);
assign(__c.begin(), __c.end());
@@ -1377,12 +1460,14 @@ deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(const deque& __c) {
# ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il) : __start_(0), __size_(0) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il)
+ : __start_(0), __size_(0) {
__annotate_new(0);
__append(__il.begin(), __il.end());
}
template <class _Tp, class _Allocator>
+_LIBCPP_CONSTEXPR_SINCE_CXX26
deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator_type& __a)
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0), __alloc_(__a) {
__annotate_new(0);
@@ -1390,7 +1475,8 @@ deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator
}
template <class _Tp, class _Allocator>
-inline deque<_Tp, _Allocator>::deque(deque&& __c) noexcept(is_nothrow_move_constructible<allocator_type>::value)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline deque<_Tp, _Allocator>::deque(deque&& __c) noexcept(
+ is_nothrow_move_constructible<allocator_type>::value)
: __map_(std::move(__c.__map_)),
__start_(std::move(__c.__start_)),
__size_(std::move(__c.__size_)),
@@ -1400,7 +1486,8 @@ inline deque<_Tp, _Allocator>::deque(deque&& __c) noexcept(is_nothrow_move_const
}
template <class _Tp, class _Allocator>
-inline deque<_Tp, _Allocator>::deque(deque&& __c, const __type_identity_t<allocator_type>& __a)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline deque<_Tp, _Allocator>::deque(
+ deque&& __c, const __type_identity_t<allocator_type>& __a)
: __map_(std::move(__c.__map_), __pointer_allocator(__a)),
__start_(std::move(__c.__start_)),
__size_(std::move(__c.__size_)),
@@ -1418,7 +1505,7 @@ inline deque<_Tp, _Allocator>::deque(deque&& __c, const __type_identity_t<alloca
}
template <class _Tp, class _Allocator>
-inline deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(deque&& __c) noexcept(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(deque&& __c) noexcept(
(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
__alloc_traits::is_always_equal::value) {
@@ -1427,7 +1514,7 @@ inline deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(deque&& __c) no
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type) {
if (__alloc() != __c.__alloc()) {
typedef move_iterator<iterator> _Ip;
assign(_Ip(__c.begin()), _Ip(__c.end()));
@@ -1436,8 +1523,8 @@ void deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type) {
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::__move_assign(deque& __c,
- true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type) noexcept(
+ is_nothrow_move_assignable<allocator_type>::value) {
clear();
shrink_to_fit();
__move_assign(__c);
@@ -1450,13 +1537,14 @@ template <class _InputIter,
__enable_if_t<__has_input_iterator_category<_InputIter>::value &&
!__has_random_access_iterator_category<_InputIter>::value,
int> >
-void deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::assign(_InputIter __f, _InputIter __l) {
__assign_with_sentinel(__f, __l);
}
template <class _Tp, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __f, _Sentinel __l) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void
+deque<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __f, _Sentinel __l) {
iterator __i = begin();
iterator __e = end();
for (; __f != __l && __i != __e; ++__f, (void)++__i)
@@ -1469,13 +1557,13 @@ _LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__assign_with_sentinel(_Itera
template <class _Tp, class _Allocator>
template <class _RAIter, __enable_if_t<__has_random_access_iterator_category<_RAIter>::value, int> >
-void deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l) {
__assign_with_size_random_access(__f, __l - __f);
}
template <class _Tp, class _Allocator>
template <class _RandomAccessIterator>
-_LIBCPP_HIDE_FROM_ABI void
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void
deque<_Tp, _Allocator>::__assign_with_size_random_access(_RandomAccessIterator __f, difference_type __n) {
if (static_cast<size_type>(__n) > size()) {
auto __l = __f + size();
@@ -1486,7 +1574,7 @@ deque<_Tp, _Allocator>::__assign_with_size_random_access(_RandomAccessIterator _
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v) {
if (__n > size()) {
std::fill_n(begin(), size(), __v);
__n -= size();
@@ -1496,12 +1584,12 @@ void deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v) {
}
template <class _Tp, class _Allocator>
-inline _Allocator deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline _Allocator deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT {
return __alloc();
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::resize(size_type __n) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::resize(size_type __n) {
if (__n > size())
__append(__n - size());
else if (__n < size())
@@ -1509,7 +1597,7 @@ void deque<_Tp, _Allocator>::resize(size_type __n) {
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::resize(size_type __n, const value_type& __v) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::resize(size_type __n, const value_type& __v) {
if (__n > size())
__append(__n - size(), __v);
else if (__n < size())
@@ -1517,7 +1605,7 @@ void deque<_Tp, _Allocator>::resize(size_type __n, const value_type& __v) {
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT {
allocator_type& __a = __alloc();
if (empty()) {
__annotate_delete();
@@ -1534,14 +1622,15 @@ void deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT {
}
template <class _Tp, class _Allocator>
-inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::operator[](size_type __i) _NOEXCEPT {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline typename deque<_Tp, _Allocator>::reference
+deque<_Tp, _Allocator>::operator[](size_type __i) _NOEXCEPT {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < size(), "deque::operator[] index out of bounds");
size_type __p = __start_ + __i;
return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-inline typename deque<_Tp, _Allocator>::const_reference
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::operator[](size_type __i) const _NOEXCEPT {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__i < size(), "deque::operator[] index out of bounds");
size_type __p = __start_ + __i;
@@ -1549,7 +1638,8 @@ deque<_Tp, _Allocator>::operator[](size_type __i) const _NOEXCEPT {
}
template <class _Tp, class _Allocator>
-inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::at(size_type __i) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline typename deque<_Tp, _Allocator>::reference
+deque<_Tp, _Allocator>::at(size_type __i) {
if (__i >= size())
std::__throw_out_of_range("deque");
size_type __p = __start_ + __i;
@@ -1557,7 +1647,8 @@ inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::at(siz
}
template <class _Tp, class _Allocator>
-inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::at(size_type __i) const {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline typename deque<_Tp, _Allocator>::const_reference
+deque<_Tp, _Allocator>::at(size_type __i) const {
if (__i >= size())
std::__throw_out_of_range("deque");
size_type __p = __start_ + __i;
@@ -1565,33 +1656,37 @@ inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::
}
template <class _Tp, class _Allocator>
-inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::front() _NOEXCEPT {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline typename deque<_Tp, _Allocator>::reference
+deque<_Tp, _Allocator>::front() _NOEXCEPT {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::front called on an empty deque");
return *(*(__map_.begin() + __start_ / __block_size) + __start_ % __block_size);
}
template <class _Tp, class _Allocator>
-inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::front() const _NOEXCEPT {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline typename deque<_Tp, _Allocator>::const_reference
+deque<_Tp, _Allocator>::front() const _NOEXCEPT {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::front called on an empty deque");
return *(*(__map_.begin() + __start_ / __block_size) + __start_ % __block_size);
}
template <class _Tp, class _Allocator>
-inline typename deque<_Tp, _Allocator>::reference deque<_Tp, _Allocator>::back() _NOEXCEPT {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline typename deque<_Tp, _Allocator>::reference
+deque<_Tp, _Allocator>::back() _NOEXCEPT {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::back called on an empty deque");
size_type __p = size() + __start_ - 1;
return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-inline typename deque<_Tp, _Allocator>::const_reference deque<_Tp, _Allocator>::back() const _NOEXCEPT {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline typename deque<_Tp, _Allocator>::const_reference
+deque<_Tp, _Allocator>::back() const _NOEXCEPT {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::back called on an empty deque");
size_type __p = size() + __start_ - 1;
return *(*(__map_.begin() + __p / __block_size) + __p % __block_size);
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::push_back(const value_type& __v) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::push_back(const value_type& __v) {
allocator_type& __a = __alloc();
if (__back_spare() == 0)
__add_back_capacity();
@@ -1602,7 +1697,7 @@ void deque<_Tp, _Allocator>::push_back(const value_type& __v) {
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::push_front(const value_type& __v) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::push_front(const value_type& __v) {
allocator_type& __a = __alloc();
if (__front_spare() == 0)
__add_front_capacity();
@@ -1615,7 +1710,7 @@ void deque<_Tp, _Allocator>::push_front(const value_type& __v) {
# ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::push_back(value_type&& __v) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::push_back(value_type&& __v) {
allocator_type& __a = __alloc();
if (__back_spare() == 0)
__add_back_capacity();
@@ -1628,7 +1723,7 @@ void deque<_Tp, _Allocator>::push_back(value_type&& __v) {
template <class _Tp, class _Allocator>
template <class... _Args>
# if _LIBCPP_STD_VER >= 17
-typename deque<_Tp, _Allocator>::reference
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::reference
# else
void
# endif
@@ -1646,7 +1741,7 @@ deque<_Tp, _Allocator>::emplace_back(_Args&&... __args) {
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::push_front(value_type&& __v) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::push_front(value_type&& __v) {
allocator_type& __a = __alloc();
if (__front_spare() == 0)
__add_front_capacity();
@@ -1660,7 +1755,7 @@ void deque<_Tp, _Allocator>::push_front(value_type&& __v) {
template <class _Tp, class _Allocator>
template <class... _Args>
# if _LIBCPP_STD_VER >= 17
-typename deque<_Tp, _Allocator>::reference
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::reference
# else
void
# endif
@@ -1681,7 +1776,8 @@ deque<_Tp, _Allocator>::emplace_front(_Args&&... __args) {
template <class _Tp, class _Allocator>
template <class... _Args>
-typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::__emplace(const_iterator __p, _Args&&... __args) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26
+ typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::__emplace(const_iterator __p, _Args&&... __args) {
size_type __pos = __p - begin();
size_type __to_end = size() - __pos;
allocator_type& __a = __alloc();
@@ -1729,7 +1825,7 @@ typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::__emplace(cons
}
template <class _Tp, class _Allocator>
-typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v) {
size_type __pos = __p - begin();
size_type __to_end = __size() - __pos;
@@ -1782,14 +1878,14 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
template <class _Tp, class _Allocator>
template <class _InputIter, __enable_if_t<__has_exactly_input_iterator_category<_InputIter>::value, int> >
-typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::insert(const_iterator __p, _InputIter __f, _InputIter __l) {
return __insert_with_sentinel(__p, __f, __l);
}
template <class _Tp, class _Allocator>
template <class _Iterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __p, _Iterator __f, _Sentinel __l) {
__split_buffer<value_type, allocator_type> __buf(__alloc());
__buf.__construct_at_end_with_sentinel(std::move(__f), std::move(__l));
@@ -1799,14 +1895,14 @@ deque<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __p, _Iterator __f
template <class _Tp, class _Allocator>
template <class _ForwardIterator, __enable_if_t<__has_exactly_forward_iterator_category<_ForwardIterator>::value, int> >
-typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::insert(const_iterator __p, _ForwardIterator __f, _ForwardIterator __l) {
return __insert_with_size(__p, __f, std::distance(__f, __l));
}
template <class _Tp, class _Allocator>
template <class _Iterator>
-_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__insert_with_size(const_iterator __p, _Iterator __f, size_type __n) {
__split_buffer<value_type, allocator_type> __buf(__n, 0, __alloc());
__buf.__construct_at_end_with_size(std::move(__f), __n);
@@ -1816,20 +1912,21 @@ deque<_Tp, _Allocator>::__insert_with_size(const_iterator __p, _Iterator __f, si
template <class _Tp, class _Allocator>
template <class _BiIter, __enable_if_t<__has_bidirectional_iterator_category<_BiIter>::value, int> >
-typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l) {
return __insert_bidirectional(__p, __f, __l, std::distance(__f, __l));
}
template <class _Tp, class _Allocator>
template <class _BiIter, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__insert_bidirectional(const_iterator __p, _BiIter __f, _Sentinel, size_type __n) {
return __insert_bidirectional(__p, __f, std::next(__f, __n), __n);
}
template <class _Tp, class _Allocator>
template <class _BiIter>
-_LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__insert_bidirectional(const_iterator __p, _BiIter __f, _BiIter __l, size_type __n) {
size_type __pos = __p - begin();
size_type __to_end = size() - __pos;
@@ -1889,13 +1986,14 @@ deque<_Tp, _Allocator>::__insert_bidirectional(const_iterator __p, _BiIter __f,
template <class _Tp, class _Allocator>
template <class _InpIter, __enable_if_t<__has_exactly_input_iterator_category<_InpIter>::value, int> >
-void deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l) {
__append_with_sentinel(__f, __l);
}
template <class _Tp, class _Allocator>
template <class _InputIterator, class _Sentinel>
-_LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__append_with_sentinel(_InputIterator __f, _Sentinel __l) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void
+deque<_Tp, _Allocator>::__append_with_sentinel(_InputIterator __f, _Sentinel __l) {
for (; __f != __l; ++__f)
# ifdef _LIBCPP_CXX03_LANG
push_back(*__f);
@@ -1906,13 +2004,14 @@ _LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__append_with_sentinel(_Input
template <class _Tp, class _Allocator>
template <class _ForIter, __enable_if_t<__has_forward_iterator_category<_ForIter>::value, int> >
-void deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l) {
__append_with_size(__f, std::distance(__f, __l));
}
template <class _Tp, class _Allocator>
template <class _InputIterator>
-_LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__append_with_size(_InputIterator __f, size_type __n) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void
+deque<_Tp, _Allocator>::__append_with_size(_InputIterator __f, size_type __n) {
allocator_type& __a = __alloc();
size_type __back_capacity = __back_spare();
if (__n > __back_capacity)
@@ -1929,7 +2028,7 @@ _LIBCPP_HIDE_FROM_ABI void deque<_Tp, _Allocator>::__append_with_size(_InputIter
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::__append(size_type __n) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::__append(size_type __n) {
allocator_type& __a = __alloc();
size_type __back_capacity = __back_spare();
if (__n > __back_capacity)
@@ -1945,7 +2044,7 @@ void deque<_Tp, _Allocator>::__append(size_type __n) {
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v) {
allocator_type& __a = __alloc();
size_type __back_capacity = __back_spare();
if (__n > __back_capacity)
@@ -1963,7 +2062,7 @@ void deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v) {
// Create front capacity for one block of elements.
// Strong guarantee. Either do it or don't touch anything.
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::__add_front_capacity() {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::__add_front_capacity() {
allocator_type& __a = __alloc();
if (__back_spare() >= __block_size) {
__start_ += __block_size;
@@ -2007,7 +2106,7 @@ void deque<_Tp, _Allocator>::__add_front_capacity() {
// Create front capacity for __n elements.
// Strong guarantee. Either do it or don't touch anything.
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
allocator_type& __a = __alloc();
size_type __nb = __recommend_blocks(__n + __map_.empty());
// Number of unused blocks at back:
@@ -2075,7 +2174,7 @@ void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
// Create back capacity for one block of elements.
// Strong guarantee. Either do it or don't touch anything.
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::__add_back_capacity() {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::__add_back_capacity() {
allocator_type& __a = __alloc();
if (__front_spare() >= __block_size) {
__start_ -= __block_size;
@@ -2118,7 +2217,7 @@ void deque<_Tp, _Allocator>::__add_back_capacity() {
// Create back capacity for __n elements.
// Strong guarantee. Either do it or don't touch anything.
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) {
allocator_type& __a = __alloc();
size_type __nb = __recommend_blocks(__n + __map_.empty());
// Number of unused blocks at front:
@@ -2187,7 +2286,7 @@ void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) {
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::pop_front() {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::pop_front() {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::pop_front called on an empty deque");
size_type __old_sz = size();
size_type __old_start = __start_;
@@ -2201,7 +2300,7 @@ void deque<_Tp, _Allocator>::pop_front() {
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::pop_back() {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::pop_back() {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(!empty(), "deque::pop_back called on an empty deque");
size_type __old_sz = size();
size_type __old_start = __start_;
@@ -2216,7 +2315,7 @@ void deque<_Tp, _Allocator>::pop_back() {
// move assign [__f, __l) to [__r, __r + (__l-__f)).
// If __vt points into [__f, __l), then subtract (__f - __r) from __vt.
template <class _Tp, class _Allocator>
-typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) {
// as if
// for (; __f != __l; ++__f, ++__r)
@@ -2230,7 +2329,7 @@ deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __
__bs = __n;
__fe = __fb + __bs;
}
- if (__fb <= __vt && __vt < __fe)
+ if (std::__is_pointer_in_range(__fb, __fe, __vt))
__vt = (const_iterator(__f.__m_iter_, __vt) -= __f - __r).__ptr_;
__r = std::move(__fb, __fe, __r);
__n -= __bs;
@@ -2242,7 +2341,7 @@ deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __
// move assign [__f, __l) to [__r - (__l-__f), __r) backwards.
// If __vt points into [__f, __l), then add (__r - __l) to __vt.
template <class _Tp, class _Allocator>
-typename deque<_Tp, _Allocator>::iterator
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) {
// as if
// while (__f != __l)
@@ -2257,7 +2356,7 @@ deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, it
__bs = __n;
__lb = __le - __bs;
}
- if (__lb <= __vt && __vt < __le)
+ if (std::__is_pointer_in_range(__lb, __le, __vt))
__vt = (const_iterator(__l.__m_iter_, __vt) += __r - __l - 1).__ptr_;
__r = std::move_backward(__lb, __le, __r);
__n -= __bs;
@@ -2269,7 +2368,8 @@ deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, it
// move construct [__f, __l) to [__r, __r + (__l-__f)).
// If __vt points into [__f, __l), then add (__r - __f) to __vt.
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void
+deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l, iterator __r, const_pointer& __vt) {
allocator_type& __a = __alloc();
// as if
// for (; __f != __l; ++__r, ++__f, ++__size())
@@ -2283,7 +2383,7 @@ void deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator _
__bs = __n;
__fe = __fb + __bs;
}
- if (__fb <= __vt && __vt < __fe)
+ if (std::__is_pointer_in_range(__fb, __fe, __vt))
__vt = (const_iterator(__f.__m_iter_, __vt) += __r - __f).__ptr_;
for (; __fb != __fe; ++__fb, ++__r, ++__size())
__alloc_traits::construct(__a, std::addressof(*__r), std::move(*__fb));
@@ -2295,7 +2395,7 @@ void deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator _
// move construct [__f, __l) to [__r - (__l-__f), __r) backwards.
// If __vt points into [__f, __l), then subtract (__l - __r) from __vt.
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::__move_construct_backward_and_check(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::__move_construct_backward_and_check(
iterator __f, iterator __l, iterator __r, const_pointer& __vt) {
allocator_type& __a = __alloc();
// as if
@@ -2315,7 +2415,7 @@ void deque<_Tp, _Allocator>::__move_construct_backward_and_check(
__bs = __n;
__lb = __le - __bs;
}
- if (__lb <= __vt && __vt < __le)
+ if (std::__is_pointer_in_range(__lb, __le, __vt))
__vt = (const_iterator(__l.__m_iter_, __vt) -= __l - __r + 1).__ptr_;
while (__le != __lb) {
__alloc_traits::construct(__a, std::addressof(*--__r), std::move(*--__le));
@@ -2328,7 +2428,8 @@ void deque<_Tp, _Allocator>::__move_construct_backward_and_check(
}
template <class _Tp, class _Allocator>
-typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_iterator __f) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::erase(const_iterator __f) {
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
__f != end(), "deque::erase(iterator) called with a non-dereferenceable iterator");
size_type __old_sz = size();
@@ -2355,7 +2456,8 @@ typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_it
}
template <class _Tp, class _Allocator>
-typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 typename deque<_Tp, _Allocator>::iterator
+deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l) {
_LIBCPP_ASSERT_VALID_INPUT_RANGE(__f <= __l, "deque::erase(first, last) called with an invalid range");
size_type __old_sz = size();
size_type __old_start = __start_;
@@ -2388,7 +2490,7 @@ typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::erase(const_it
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f) {
size_type __old_sz = size();
size_type __old_start = __start_;
iterator __e = end();
@@ -2407,7 +2509,7 @@ void deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f) {
}
template <class _Tp, class _Allocator>
-inline void deque<_Tp, _Allocator>::swap(deque& __c)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline void deque<_Tp, _Allocator>::swap(deque& __c)
# if _LIBCPP_STD_VER >= 14
_NOEXCEPT
# else
@@ -2421,7 +2523,7 @@ inline void deque<_Tp, _Allocator>::swap(deque& __c)
}
template <class _Tp, class _Allocator>
-inline void deque<_Tp, _Allocator>::clear() _NOEXCEPT {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline void deque<_Tp, _Allocator>::clear() _NOEXCEPT {
__annotate_delete();
allocator_type& __a = __alloc();
for (iterator __i = begin(), __e = end(); __i != __e; ++__i)
@@ -2443,7 +2545,8 @@ inline void deque<_Tp, _Allocator>::clear() _NOEXCEPT {
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline _LIBCPP_HIDE_FROM_ABI bool
+operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
const typename deque<_Tp, _Allocator>::size_type __sz = __x.size();
return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
@@ -2451,34 +2554,39 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator==(const deque<_Tp, _Allocator>& __x,
# if _LIBCPP_STD_VER <= 17
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline
+ _LIBCPP_HIDE_FROM_ABI bool operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
return !(__x == __y);
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool operator<(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline _LIBCPP_HIDE_FROM_ABI bool
+operator<(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool operator>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline _LIBCPP_HIDE_FROM_ABI bool
+operator>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
return __y < __x;
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline _LIBCPP_HIDE_FROM_ABI bool
+operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
return !(__x < __y);
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline _LIBCPP_HIDE_FROM_ABI bool
+operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
return !(__y < __x);
}
# else // _LIBCPP_STD_VER <= 17
template <class _Tp, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Tp>
operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) {
return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
}
@@ -2486,22 +2594,23 @@ operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y
# endif // _LIBCPP_STD_VER <= 17
template <class _Tp, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI void swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
- _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline
+ _LIBCPP_HIDE_FROM_ABI void swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
+ _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
__x.swap(__y);
}
# if _LIBCPP_STD_VER >= 20
template <class _Tp, class _Allocator, class _Up>
-inline _LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::size_type
-erase(deque<_Tp, _Allocator>& __c, const _Up& __v) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline _LIBCPP_HIDE_FROM_ABI
+typename deque<_Tp, _Allocator>::size_type erase(deque<_Tp, _Allocator>& __c, const _Up& __v) {
auto __old_size = __c.size();
__c.erase(std::remove(__c.begin(), __c.end(), __v), __c.end());
return __old_size - __c.size();
}
template <class _Tp, class _Allocator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::size_type
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline _LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::size_type
erase_if(deque<_Tp, _Allocator>& __c, _Predicate __pred) {
auto __old_size = __c.size();
__c.erase(std::remove_if(__c.begin(), __c.end(), __pred), __c.end());
diff --git a/libcxx/include/version b/libcxx/include/version
index 1c683b67e5700..92f39f1a08165 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -71,6 +71,7 @@ __cpp_lib_constexpr_bitset 202207L <bitset>
__cpp_lib_constexpr_charconv 202207L <charconv>
__cpp_lib_constexpr_cmath 202202L <cmath> <cstdlib>
__cpp_lib_constexpr_complex 201711L <complex>
+__cpp_lib_constexpr_deque 202502L <deque>
__cpp_lib_constexpr_dynamic_alloc 201907L <memory>
__cpp_lib_constexpr_flat_map 202502L <flat_map>
__cpp_lib_constexpr_flat_set 202502L <flat_set>
@@ -564,6 +565,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_constant_wrapper 202603L
# undef __cpp_lib_constexpr_algorithms
# define __cpp_lib_constexpr_algorithms 202306L
+# define __cpp_lib_constexpr_deque 202502L
# define __cpp_lib_constexpr_flat_map 202502L
# define __cpp_lib_constexpr_flat_set 202502L
# define __cpp_lib_constexpr_forward_list 202502L
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp
index 10aad31778ea9..73d34b31bbb77 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp
@@ -96,7 +96,7 @@ TEST_CONSTEXPR_CXX20 bool test_vector_bool(std::size_t N) {
return true;
}
-/*TEST_CONSTEXPR_CXX26*/ void test_deque() { // TODO: Mark as TEST_CONSTEXPR_CXX26 once std::deque is constexpr
+TEST_CONSTEXPR_CXX26 void test_deque() {
std::deque<int> in(20);
std::deque<int> expected(in.size(), 42);
std::fill(in.begin(), in.end(), 42);
@@ -148,7 +148,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
}
}
- if (!TEST_IS_CONSTANT_EVALUATED) // TODO: Use TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED when std::deque is made constexpr
+ if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED)
test_deque();
#if TEST_STD_VER >= 20
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
index 6d7ba98a33b65..ba809c9b7b194 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
@@ -129,7 +129,7 @@ TEST_CONSTEXPR_CXX20 bool test_vector_bool(std::size_t N) {
return true;
}
-/*TEST_CONSTEXPR_CXX26*/ void test_deque() { // TODO: Mark as TEST_CONSTEXPR_CXX26 once std::deque is constexpr
+TEST_CONSTEXPR_CXX26 void test_deque() {
std::deque<int> in(20);
std::deque<int> expected(in.size(), 42);
std::fill_n(in.begin(), in.size(), 42);
@@ -231,7 +231,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
}
}
- if (!TEST_IS_CONSTANT_EVALUATED) // TODO: Use TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED when std::deque is made constexpr
+ if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED)
test_deque();
#if TEST_STD_VER >= 20
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill.pass.cpp
index 79543832d6e20..ab4bb9316783f 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill.pass.cpp
@@ -130,7 +130,7 @@ constexpr bool test_vector_bool(std::size_t N) {
}
#endif
-/*TEST_CONSTEXPR_CXX26*/ void test_deque() { // TODO: Mark as TEST_CONSTEXPR_CXX26 once std::deque is constexpr
+TEST_CONSTEXPR_CXX26 void test_deque() {
std::deque<int> in(20);
std::deque<int> expected(in.size(), 42);
std::ranges::fill(in, 42);
@@ -236,7 +236,7 @@ constexpr bool test() {
}
#endif
- if (!TEST_IS_CONSTANT_EVALUATED) // TODO: Use TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED when std::deque is made constexpr
+ if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED)
test_deque();
#if TEST_STD_VER >= 20
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill_n.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill_n.pass.cpp
index 0de6f4a625136..a4f4f17b8ea8e 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill_n.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill_n.pass.cpp
@@ -103,7 +103,7 @@ constexpr bool test_vector_bool(std::size_t N) {
}
#endif
-/*TEST_CONSTEXPR_CXX26*/ void test_deque() { // TODO: Mark as TEST_CONSTEXPR_CXX26 once std::deque is constexpr
+TEST_CONSTEXPR_CXX26 void test_deque() {
std::deque<int> in(20);
std::deque<int> expected(in.size(), 42);
std::ranges::fill_n(std::ranges::begin(in), std::ranges::size(in), 42);
@@ -184,7 +184,7 @@ constexpr bool test() {
}
#endif
- if (!TEST_IS_CONSTANT_EVALUATED) // TODO: Use TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED when std::deque is made constexpr
+ if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED)
test_deque();
#if TEST_STD_VER >= 20
diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp
index 288bfb392ad2e..faf8ab1f50d0e 100644
--- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp
@@ -38,16 +38,16 @@ struct deque_test {
std::deque<int>* d_;
int* i_;
- deque_test(std::deque<int>& d, int& i) : d_(&d), i_(&i) {}
+ TEST_CONSTEXPR_CXX26 deque_test(std::deque<int>& d, int& i) : d_(&d), i_(&i) {}
- void operator()(int& v) {
+ TEST_CONSTEXPR_CXX26 void operator()(int& v) {
assert(&(*d_)[*i_] == &v);
++*i_;
}
};
/*TEST_CONSTEXPR_CXX26*/
-void test_deque_and_join_view_iterators() { // TODO: Mark as TEST_CONSTEXPR_CXX26 once std::deque is constexpr
+TEST_CONSTEXPR_CXX26 void test_deque_and_join_view_iterators() {
{ // Verify that segmented deque iterators work properly
int sizes[] = {0, 1, 2, 1023, 1024, 1025, 2047, 2048, 2049};
for (const int size : sizes) {
@@ -117,7 +117,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
assert(it == (std::begin(ia) + N) && std::equal(std::begin(ia), std::end(ia), std::begin(expected)));
}
- if (!TEST_IS_CONSTANT_EVALUATED) // TODO: Use TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED when std::deque is made constexpr
+ if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED)
test_deque_and_join_view_iterators();
#if TEST_STD_VER >= 20
diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each.pass.cpp
index 86c5a8a39736f..9f786d88b2d2c 100644
--- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each.pass.cpp
@@ -118,16 +118,16 @@ struct deque_test {
std::deque<int>* d_;
int* i_;
- deque_test(std::deque<int>& d, int& i) : d_(&d), i_(&i) {}
+ TEST_CONSTEXPR_CXX26 deque_test(std::deque<int>& d, int& i) : d_(&d), i_(&i) {}
- void operator()(int& v) {
+ TEST_CONSTEXPR_CXX26 void operator()(int& v) {
assert(&(*d_)[*i_] == &v);
++*i_;
}
};
/*TEST_CONSTEXPR_CXX26*/
-void test_segmented_deque_iterator() { // TODO: Mark as TEST_CONSTEXPR_CXX26 once std::deque is constexpr
+TEST_CONSTEXPR_CXX26 void test_segmented_deque_iterator() {
// check that segmented deque iterators work properly
int sizes[] = {0, 1, 2, 1023, 1024, 1025, 2047, 2048, 2049};
for (const int size : sizes) {
@@ -174,7 +174,7 @@ constexpr bool test() {
}
}
- if (!TEST_IS_CONSTANT_EVALUATED) // TODO: Use TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED when std::deque is made constexpr
+ if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED)
test_segmented_deque_iterator();
{
diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each_n.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each_n.pass.cpp
index a82fb6afaad0b..3fa3f9bc0059e 100644
--- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each_n.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each_n.pass.cpp
@@ -74,16 +74,16 @@ struct deque_test {
std::deque<int>* d_;
int* i_;
- deque_test(std::deque<int>& d, int& i) : d_(&d), i_(&i) {}
+ TEST_CONSTEXPR_CXX26 deque_test(std::deque<int>& d, int& i) : d_(&d), i_(&i) {}
- void operator()(int& v) {
+ TEST_CONSTEXPR_CXX26 void operator()(int& v) {
assert(&(*d_)[*i_] == &v);
++*i_;
}
};
/*TEST_CONSTEXPR_CXX26*/
-void test_segmented_deque_iterator() { // TODO: Mark as TEST_CONSTEXPR_CXX26 once std::deque is constexpr
+TEST_CONSTEXPR_CXX26 void test_segmented_deque_iterator() {
// check that segmented deque iterators work properly
int sizes[] = {0, 1, 2, 1023, 1024, 1025, 2047, 2048, 2049};
for (const int size : sizes) {
@@ -119,7 +119,7 @@ constexpr bool test() {
assert(a[2].other == 6);
}
- if (!TEST_IS_CONSTANT_EVALUATED) // TODO: Use TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED when std::deque is made constexpr
+ if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED)
test_segmented_deque_iterator();
{
diff --git a/libcxx/test/std/containers/sequences/deque/compare.pass.cpp b/libcxx/test/std/containers/sequences/deque/compare.pass.cpp
index 526e3d38e7dff..d55bf8576d852 100644
--- a/libcxx/test/std/containers/sequences/deque/compare.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/compare.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// template<class T, class Alloc>
// bool operator==(const std::deque<T, Alloc>& lhs,
// const std::deque<T,Alloc>& rhs);
@@ -36,8 +38,28 @@
#include <cassert>
#include "test_comparisons.h"
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> a = {1, 2, 3};
+ std::deque<int> b = {1, 2, 4};
+ assert(a == a);
+ assert(a != b);
+ assert(a < b);
+ assert(a <= b);
+ assert(b > a);
+ assert(b >= a);
+ return true;
+}
+#endif
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
const std::deque<int> d1, d2;
assert(testComparisons(d1, d2, true, false));
diff --git a/libcxx/test/std/containers/sequences/deque/compare.three_way.pass.cpp b/libcxx/test/std/containers/sequences/deque/compare.three_way.pass.cpp
index 3d5646a844951..556b95ce4677d 100644
--- a/libcxx/test/std/containers/sequences/deque/compare.three_way.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/compare.three_way.pass.cpp
@@ -9,6 +9,8 @@
// <deque>
+// constexpr since C++26
+
// template<class T, class Allocator>
// synth-three-way-result<T> operator<=>(const deque<T, Allocator>& x,
// const deque<T, Allocator>& y);
@@ -17,9 +19,23 @@
#include <deque>
#include "test_container_comparisons.h"
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> a = {1, 2, 3};
+ std::deque<int> b = {1, 2, 4};
+ assert((a <=> b) < 0);
+ return true;
+}
+#endif
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
assert(test_sequence_container_spaceship<std::deque>());
- // `std::deque` is not constexpr, so no `static_assert` test here.
return 0;
}
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
index 294663c5bd356..069e0760a72e3 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// reference operator[](size_type __i);
// const_reference operator[](size_type __i) const;
//
@@ -47,7 +49,23 @@ C make(int size, int start = 0) {
return c;
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ assert(d[0] == 1);
+ assert(d.at(2) == 3);
+ assert(d.front() == 1);
+ assert(d.back() == 3);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
typedef std::deque<int> C;
C c = make<std::deque<int> >(10);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp
index 5e3a6ec1cea82..ded50ae238b0e 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/empty.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// class deque
// bool empty() const noexcept;
@@ -19,7 +21,22 @@
#include "test_macros.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ assert(d.empty());
+ d.push_back(1);
+ assert(!d.empty());
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
typedef std::deque<int> C;
C c;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
index 39feabe3889b3..10b436e32e1c0 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// size_type max_size() const;
#include "asan_testing.h"
@@ -19,7 +21,20 @@
#include "test_allocator.h"
#include "test_macros.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ assert(d.max_size() > 0);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
typedef limited_allocator<int, 10> A;
typedef std::deque<int, A> C;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
index 767fe7ae8864e..4c64f8cda2bbc 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// void resize(size_type n);
#include "asan_testing.h"
@@ -63,7 +65,23 @@ void testN(int start, int N, int M) {
test(c1, M);
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ d.resize(5);
+ assert((d == std::deque<int>{1, 2, 3, 0, 0}));
+ d.resize(2);
+ assert((d == std::deque<int>{1, 2}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
index 0abd94759a50f..8d23475b88f00 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// void resize(size_type n, const value_type& v);
#include "asan_testing.h"
@@ -63,7 +65,21 @@ void testN(int start, int N, int M) {
test(c1, M, -10);
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2};
+ d.resize(4, 9);
+ assert((d == std::deque<int>{1, 2, 9, 9}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp
index 34eedf8d050b7..8d636dc57e8bd 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// void shrink_to_fit();
#include "asan_testing.h"
@@ -50,7 +52,21 @@ void testN(int start, int N) {
test(c1);
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ d.shrink_to_fit();
+ assert(d.size() == 3);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp
index 5c6a34867b39a..abaefc361c0de 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.capacity/size.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// class deque
// size_type size() const noexcept;
@@ -19,7 +21,20 @@
#include "test_macros.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ assert(d.size() == 3);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
typedef std::deque<int> C;
C c;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp
index 4b19ef3e22173..8c325e0c002ab 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/alloc.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// explicit deque(const allocator_type& a);
#include "asan_testing.h"
@@ -27,7 +29,20 @@ void test(const Allocator& a) {
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(d));
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d((std::allocator<int>()));
+ assert(d.empty());
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
test<int>(std::allocator<int>());
test<NotConstructible>(test_allocator<NotConstructible>(3));
#if TEST_STD_VER >= 11
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp
index bc57098463eaa..7342ef2381c56 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// void assign(initializer_list<value_type> il);
#include "asan_testing.h"
@@ -19,7 +21,21 @@
#include "test_macros.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ d.assign({1, 2, 3});
+ assert((d == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
std::deque<int> d;
d.assign({3, 4, 5, 6});
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
index c57eb9d08cabe..90e9f54b13e16 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// template <class InputIterator>
// void assign(InputIterator f, InputIterator l);
@@ -142,7 +144,22 @@ void test_iterators() {
test_emplacable_concept<int*>();
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ int input[] = {1, 2, 3};
+ std::deque<int> d;
+ d.assign(input, input + 3);
+ assert((d == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
basic_test();
return 0;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
index 30277125e46e1..0fd15637dda6c 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// void assign(size_type n, const value_type& v);
#include "asan_testing.h"
@@ -55,7 +57,21 @@ void testN(int start, int N, int M) {
test(c1, M, -10);
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ d.assign(3, 7);
+ assert((d == std::deque<int>{7, 7, 7}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
index 9f7a429d122a3..ed164e3b52595 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// deque(const deque&);
#include "asan_testing.h"
@@ -26,7 +28,21 @@ void test(const C& x) {
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(x));
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ std::deque<int> copy(d);
+ assert(copy == d);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
int* an = ab + sizeof(ab) / sizeof(ab[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp
index fb3ad3c25a8f1..3e06ad8014c32 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/copy_alloc.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// deque(const deque& c, const allocator_type& a);
#include "asan_testing.h"
@@ -26,7 +28,21 @@ void test(const C& x, const typename C::allocator_type& a) {
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c));
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ std::deque<int> copy(d, std::allocator<int>());
+ assert(copy == d);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
int* an = ab + sizeof(ab) / sizeof(ab[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/default.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
index 6bfd4857f9b0a..9946bb712f033 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// deque()
#include "asan_testing.h"
@@ -31,7 +33,21 @@ void test() {
#endif
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ assert(d.empty());
+ assert(d.begin() == d.end());
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
test<int, std::allocator<int> >();
test<NotConstructible, limited_allocator<NotConstructible, 1> >();
#if TEST_STD_VER >= 11
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
index 338a0fa6b832d..607af466eddb7 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// ~deque() // implied noexcept;
// UNSUPPORTED: c++03
@@ -28,7 +30,32 @@ struct some_alloc {
void allocate(std::size_t);
};
+#if TEST_STD_VER >= 26
+struct NonTrivial {
+ int value;
+
+ constexpr NonTrivial(int v = 0) : value(v) {}
+ constexpr NonTrivial(const NonTrivial&) = default;
+ constexpr ~NonTrivial() {}
+};
+
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<NonTrivial> d;
+ for (int i = 0; i != 50; ++i)
+ d.emplace_back(i);
+ assert(d.size() == 50);
+ assert(d.front().value == 0);
+ assert(d.back().value == 49);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
typedef std::deque<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/from_range.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/from_range.pass.cpp
index 3b3632a3d3c67..bb3ce2e395d92 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/from_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/from_range.pass.cpp
@@ -9,15 +9,30 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
+#include <cassert>
#include <deque>
#include "../../from_range_sequence_containers.h"
#include "test_macros.h"
// template<container-compatible-range<T> R>
-// deque(from_range_t, R&& rg, const Allocator& = Allocator()); // C++23
+// deque(from_range_t, R&& rg, const Allocator& = Allocator()); // C++23; constexpr since C++26
+
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ int input[] = {1, 2, 3};
+ std::deque<int> d(std::from_range, input);
+ assert((d == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
for_all_iterators_and_allocators<int>([]<class Iter, class Sent, class Alloc>() {
test_sequence_container<std::deque, int, Iter, Sent, Alloc>([]([[maybe_unused]] const auto& c) {
LIBCPP_ASSERT(c.__invariants());
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp
index d7df936f9413d..1c46829aa63e6 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// deque(initializer_list<value_type> il);
#include "asan_testing.h"
@@ -19,7 +21,21 @@
#include "test_macros.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ assert(d.size() == 3);
+ assert(d.back() == 3);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
std::deque<int> d = {3, 4, 5, 6};
assert(d.size() == 4);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
index f5f1a23243002..c5b33854a2124 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// deque(initializer_list<value_type> il, const Allocator& a = allocator_type());
#include "asan_testing.h"
@@ -20,7 +22,21 @@
#include "test_allocator.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d({1, 2, 3}, std::allocator<int>());
+ assert(d.size() == 3);
+ assert(d.front() == 1);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
std::deque<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
assert(d.get_allocator() == test_allocator<int>(3));
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
index 59d93ac7ea411..8084df24dcd98 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// template <class InputIterator> deque(InputIterator f, InputIterator l);
#include "asan_testing.h"
@@ -101,7 +103,22 @@ void test_emplacable_concept() {
#endif
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ int input[] = {1, 2, 3};
+ std::deque<int> d(input, input + 3);
+ assert(d.size() == 3);
+ assert(d[2] == 3);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
basic_test();
test_emplacable_concept();
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
index ef876bb272fc7..a07bffcc608bc 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// template <class InputIterator>
// deque(InputIterator f, InputIterator l, const allocator_type& a);
@@ -97,7 +99,22 @@ void test_emplacable_concept() {
#endif
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ int input[] = {1, 2, 3};
+ std::deque<int> d(input, input + 3, std::allocator<int>());
+ assert(d.size() == 3);
+ assert(d.front() == 1);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
basic_test();
test_emplacable_concept();
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp
index 66ff168cc83b7..0ded7d5f1f165 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/move.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// deque(deque&&);
#include "asan_testing.h"
@@ -21,7 +23,21 @@
#include "test_allocator.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ std::deque<int> moved(static_cast<std::deque<int>&&>(d));
+ assert((moved == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
int* an = ab + sizeof(ab) / sizeof(ab[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp
index 985d8ad9db67f..52451b72a6486 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// deque(deque&& c, const allocator_type& a);
#include "asan_testing.h"
@@ -21,7 +23,21 @@
#include "test_allocator.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ std::deque<int> moved(static_cast<std::deque<int>&&>(d), std::allocator<int>());
+ assert((moved == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
const int* an = ab + sizeof(ab) / sizeof(ab[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp
index 426dea0347101..afd7b3607aa3c 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// deque& operator=(deque&& c);
#include "asan_testing.h"
@@ -21,7 +23,22 @@
#include "test_allocator.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ std::deque<int> other = {1, 2, 3};
+ d = static_cast<std::deque<int>&&>(other);
+ assert((d == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
int* an = ab + sizeof(ab) / sizeof(ab[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp
index 05d172268e0bd..9a15782935bf5 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// deque& operator=(const deque& c);
#include "asan_testing.h"
@@ -26,7 +28,21 @@ void test(const C& x) {
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(x));
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ d = std::deque<int>{1, 2, 3};
+ assert((d == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
int* an = ab + sizeof(ab) / sizeof(ab[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp
index b2760b4a3ff49..eed4784eeb3f4 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// deque& operator=(initializer_list<value_type> il);
#include "asan_testing.h"
@@ -19,7 +21,21 @@
#include "test_macros.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ d = {1, 2, 3};
+ assert((d == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
std::deque<int> d;
d = {3, 4, 5, 6};
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
index f8f42bd668f83..a5957be3dc477 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// explicit deque(size_type n);
#include "asan_testing.h"
@@ -82,7 +84,21 @@ void test(unsigned n) {
test2<T, Allocator>(n);
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d(3);
+ assert(d.size() == 3);
+ assert(d[0] == 0);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
test<DefaultOnly, std::allocator<DefaultOnly> >(0);
test<DefaultOnly, std::allocator<DefaultOnly> >(1);
test<DefaultOnly, std::allocator<DefaultOnly> >(10);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
index 231aa9c44c663..2ebabbcbf7b3b 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// deque(size_type n, const value_type& v);
#include "asan_testing.h"
@@ -31,7 +33,22 @@ void test(unsigned n, const T& x) {
assert(*i == x);
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d(3, 7);
+ assert(d.size() == 3);
+ assert(d.front() == 7);
+ assert(d.back() == 7);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
test<int, std::allocator<int> >(0, 5);
test<int, std::allocator<int> >(1, 10);
test<int, std::allocator<int> >(10, 11);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
index f8ea37e64d9eb..77bae7a9cbb3a 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// deque(size_type n, const value_type& v, const allocator_type& a);
#include "asan_testing.h"
@@ -31,7 +33,21 @@ void test(unsigned n, const T& x, const Allocator& a) {
assert(*i == x);
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d(3, 7, std::allocator<int>());
+ assert(d.size() == 3);
+ assert(d[1] == 7);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
std::allocator<int> a;
test(0, 5, a);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp
index 947e06bd64375..a4a0f6eeefd1f 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp
@@ -11,11 +11,14 @@
// <deque>
+// constexpr since C++26
+
// template <class T, class Allocator, class U>
// typename deque<T, Allocator>::size_type
// erase(deque<T, Allocator>& c, const U& value);
#include "asan_testing.h"
+#include <cassert>
#include <deque>
#include <optional>
@@ -66,7 +69,21 @@ void test() {
test0(S({1, 2, 1}), opt(3), S({1, 2, 1}), 0);
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 1, 3};
+ assert(std::erase(d, 1) == 2);
+ assert((d == std::deque<int>{2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
test<std::deque<int>>();
test<std::deque<int, min_allocator<int>>>();
test<std::deque<int, safe_allocator<int>>>();
diff --git a/libcxx/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp
index ed5220422dab2..3cc0907daaec3 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp
@@ -11,11 +11,14 @@
// <deque>
+// constexpr since C++26
+
// template <class T, class Allocator, class Predicate>
// typename deque<T, Allocator>::size_type
// erase_if(deque<T, Allocator>& c, Predicate pred);
#include "asan_testing.h"
+#include <cassert>
#include <deque>
#include "test_macros.h"
@@ -68,7 +71,21 @@ void test() {
test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3, 4};
+ assert(std::erase_if(d, [](int v) { return v % 2 == 0; }) == 2);
+ assert((d == std::deque<int>{1, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
test<std::deque<int>>();
test<std::deque<int, min_allocator<int>>>();
test<std::deque<int, safe_allocator<int>>>();
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/append_range.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/append_range.pass.cpp
index be91242b3d292..9994dc3019728 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/append_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/append_range.pass.cpp
@@ -10,8 +10,9 @@
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
// template<container-compatible-range<T> R>
-// constexpr void append_range(R&& rg); // C++23
+// constexpr void append_range(R&& rg); // C++23; constexpr since C++26
+#include <cassert>
#include <deque>
#include "../../insert_range_sequence_containers.h"
@@ -22,7 +23,23 @@
// {empty/one-element/full} container);
// - appending move-only elements;
// - an exception is thrown when copying the elements or when allocating new elements.
+
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ int input[] = {2, 3};
+ std::deque<int> d = {1};
+ d.append_range(input);
+ assert((d == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
static_assert(test_constraints_append_range<std::deque, int, double>());
for_all_iterators_and_allocators<int, const int*>([]<class Iter, class Sent, class Alloc>() {
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/assign_range.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/assign_range.pass.cpp
index 744e03a7b983e..73513a5e77404 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/assign_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/assign_range.pass.cpp
@@ -9,8 +9,9 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// template<container-compatible-range<T> R>
-// constexpr void assign_range(R&& rg); // C++23
+// constexpr void assign_range(R&& rg); // C++23; constexpr since C++26
+#include <cassert>
#include <deque>
#include "../../insert_range_sequence_containers.h"
@@ -21,7 +22,23 @@
// {empty/one-element/full} container);
// - assigning move-only elements;
// - an exception is thrown when copying the elements or when allocating new elements.
+
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ int input[] = {1, 2, 3};
+ std::deque<int> d;
+ d.assign_range(input);
+ assert((d == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
static_assert(test_constraints_assign_range<std::deque, int, double>());
for_all_iterators_and_allocators<int, const int*>([]<class Iter, class Sent, class Alloc>() {
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp
index bb2fa6e52af43..d200593b7549d 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// void clear() noexcept;
#include "asan_testing.h"
@@ -18,7 +20,21 @@
#include "../../../NotConstructible.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ d.clear();
+ assert(d.empty());
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
typedef NotConstructible T;
typedef std::deque<T> C;
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
index 7c90216a9ce56..87edb62a03b71 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// template <class... Args> iterator emplace(const_iterator p, Args&&... args);
// UNSUPPORTED: c++03
@@ -74,7 +76,22 @@ void testN(int start, int N) {
}
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 3};
+ auto it = d.emplace(d.begin() + 1, 2);
+ assert(*it == 2);
+ assert((d == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
index 590ab432dd519..da540dcd26b1d 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// template <class... Args> reference emplace_back(Args&&... args);
// return type is 'reference' in C++17; 'void' before
@@ -68,7 +70,21 @@ void testN(int start, int N) {
test(c1);
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ d.emplace_back(1);
+ assert(d.back() == 1);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
index 3fbaee1fc1587..d399060ab4a46 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// template <class... Args> reference emplace_front(Args&&... args);
// return type is 'reference' in C++17; 'void' before
@@ -68,7 +70,21 @@ void testN(int start, int N) {
test(c1);
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ d.emplace_front(1);
+ assert(d.front() == 1);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
index 2d40f0c449f4d..f1463de900651 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// iterator erase(const_iterator p)
#include "asan_testing.h"
@@ -93,7 +95,22 @@ void testN(int start, int N) {
}
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ auto it = d.erase(d.begin() + 1);
+ assert(*it == 3);
+ assert((d == std::deque<int>{1, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
index 1eaa7a6c72a57..d236924770f3c 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// iterator erase(const_iterator f, const_iterator l)
#include "asan_testing.h"
@@ -99,7 +101,22 @@ void testN(int start, int N) {
}
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3, 4};
+ auto it = d.erase(d.begin() + 1, d.begin() + 3);
+ assert(*it == 4);
+ assert((d == std::deque<int>{1, 4}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp
index 117ce63b93d7e..a10e83a6ca9e1 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// iterator insert(const_iterator p, initializer_list<value_type> il);
#include "asan_testing.h"
@@ -19,7 +21,22 @@
#include "test_macros.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 4};
+ auto it = d.insert(d.begin() + 1, {2, 3});
+ assert(*it == 2);
+ assert((d == std::deque<int>{1, 2, 3, 4}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
std::deque<int> d(10, 1);
std::deque<int>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6});
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
index 3941c1e8bc6c5..54f62e6a049dc 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
@@ -16,6 +16,8 @@
// <deque>
+// constexpr since C++26
+
// template <class InputIterator>
// iterator insert (const_iterator p, InputIterator f, InputIterator l);
@@ -235,7 +237,23 @@ void test_move() {
#endif
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ int input[] = {2, 3};
+ std::deque<int> d = {1, 4};
+ auto it = d.insert(d.begin() + 1, input, input + 2);
+ assert(*it == 2);
+ assert((d == std::deque<int>{1, 2, 3, 4}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_range.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_range.pass.cpp
index 7681eb63b9076..39a6793089be1 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_range.pass.cpp
@@ -14,8 +14,9 @@
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
// template<container-compatible-range<T> R>
-// constexpr iterator insert_range(const_iterator position, R&& rg); // C++23
+// constexpr iterator insert_range(const_iterator position, R&& rg); // C++23; constexpr since C++26
+#include <cassert>
#include <deque>
#include "../../insert_range_sequence_containers.h"
@@ -26,7 +27,24 @@
// {empty/one-element/full} container at the {beginning/middle/end});
// - inserting move-only elements;
// - an exception is thrown when copying the elements or when allocating new elements.
+
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ int input[] = {2, 3};
+ std::deque<int> d = {1, 4};
+ auto it = d.insert_range(d.begin() + 1, input);
+ assert(*it == 2);
+ assert((d == std::deque<int>{1, 2, 3, 4}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
static_assert(test_constraints_insert_range<std::deque, int, double>());
for_all_iterators_and_allocators<int, const int*>([]<class Iter, class Sent, class Alloc>() {
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
index ff4654cf0ccb3..3b605771213c2 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// iterator insert (const_iterator p, value_type&& v);
// UNSUPPORTED: c++03
@@ -80,7 +82,23 @@ void testN(int start, int N) {
}
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 3};
+ int value = 2;
+ auto it = d.insert(d.begin() + 1, static_cast<int&&>(value));
+ assert(*it == 2);
+ assert((d == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
index 05a16a9e76387..f93e055ea3eb9 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// iterator insert (const_iterator p, size_type n, const value_type& v);
#include "asan_testing.h"
@@ -113,7 +115,22 @@ void self_reference_test() {
}
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 4};
+ auto it = d.insert(d.begin() + 1, 2, 2);
+ assert(*it == 2);
+ assert((d == std::deque<int>{1, 2, 2, 4}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
index b9440acb4986a..8f3b87e06ab31 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// iterator insert (const_iterator p, const value_type& v);
#include "asan_testing.h"
@@ -99,7 +101,22 @@ void self_reference_test() {
}
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 3};
+ auto it = d.insert(d.begin() + 1, 2);
+ assert(*it == 2);
+ assert((d == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
index 301d8e3342bb6..c4e2439aaa190 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// void pop_back()
#include "asan_testing.h"
@@ -58,7 +60,21 @@ void testN(int start, int N) {
}
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ d.pop_back();
+ assert((d == std::deque<int>{1, 2}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
index 2bd390ac315e0..f90be2a052ea1 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// void pop_front()
#include "asan_testing.h"
@@ -58,7 +60,21 @@ void testN(int start, int N) {
}
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ d.pop_front();
+ assert((d == std::deque<int>{2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/prepend_range.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/prepend_range.pass.cpp
index 5ff572c79e512..3f1fbe0c8d142 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/prepend_range.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/prepend_range.pass.cpp
@@ -10,8 +10,9 @@
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
// template<container-compatible-range<T> R>
-// constexpr void prepend_range(R&& rg); // C++23
+// constexpr void prepend_range(R&& rg); // C++23; constexpr since C++26
+#include <cassert>
#include <deque>
#include "../../insert_range_sequence_containers.h"
@@ -22,7 +23,23 @@
// {empty/one-element/full} container);
// - prepending move-only elements;
// - an exception is thrown when copying the elements or when allocating new elements.
+
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ int input[] = {1, 2};
+ std::deque<int> d = {3};
+ d.prepend_range(input);
+ assert((d == std::deque<int>{1, 2, 3}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
static_assert(test_constraints_prepend_range<std::deque, int, double>());
for_all_iterators_and_allocators<int, const int*>([]<class Iter, class Sent, class Alloc>() {
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp
index fff3433ab4dd4..371add5b73af2 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// void push_back(const value_type& v);
// void pop_back();
// void pop_front();
@@ -51,7 +53,22 @@ void test(int size) {
}
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ d.push_back(1);
+ d.push_back(2);
+ assert((d == std::deque<int>{1, 2}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
index c9e0ca7a6d7e0..1af12ca2f9b79 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// void push_back(value_type&& v);
// void pop_back();
// void pop_front();
@@ -54,7 +56,22 @@ void test(int size) {
}
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ int value = 1;
+ d.push_back(static_cast<int&&>(value));
+ assert((d == std::deque<int>{1}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
index 1fb8341895a35..2d3131c1208d9 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// void push_front(const value_type& v);
#include "asan_testing.h"
@@ -58,7 +60,22 @@ void testN(int start, int N) {
test(c1, -10);
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ d.push_front(2);
+ d.push_front(1);
+ assert((d == std::deque<int>{1, 2}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
index 418a0c976e66c..daecdc4bc8946 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
@@ -10,6 +10,8 @@
// <deque>
+// constexpr since C++26
+
// void push_front(value_type&& v);
#include "asan_testing.h"
@@ -61,7 +63,22 @@ void testN(int start, int N) {
test(c1, -10);
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ int value = 1;
+ d.push_front(static_cast<int&&>(value));
+ assert((d == std::deque<int>{1}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/deque.special/swap.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
index 07004315a0bfb..6ddb41bca9f68 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// template <class T, class A>
// void swap(deque<T, A>& x, deque<T, A>& y);
@@ -52,7 +54,23 @@ void testN(int start, int N, int M) {
LIBCPP_ASSERT(is_double_ended_contiguous_container_asan_correct(c2_save));
}
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> a = {1, 2};
+ std::deque<int> b = {3};
+ swap(a, b);
+ assert((a == std::deque<int>{3}));
+ assert((b == std::deque<int>{1, 2}));
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng) / sizeof(rng[0]);
diff --git a/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp b/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp
index 6b8bc6c555bcd..dbb71cd42953f 100644
--- a/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/get_allocator.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// class deque
// allocator_type get_allocator() const
@@ -18,7 +20,20 @@
#include "test_allocator.h"
#include "test_macros.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d;
+ assert(d.get_allocator() == std::allocator<int>());
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
std::allocator<int> alloc;
const std::deque<int> d(alloc);
diff --git a/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp b/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp
index 337fd688ebcdb..820110a2df57b 100644
--- a/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/iterators.pass.cpp
@@ -8,6 +8,8 @@
// <deque>
+// constexpr since C++26
+
// Test nested types and default template args:
// template <class T, class Allocator = allocator<T> >
@@ -22,7 +24,24 @@
#include "test_macros.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 26
+TEST_CONSTEXPR_CXX26 bool test_constexpr() {
+ std::deque<int> d = {1, 2, 3};
+ assert(*d.begin() == 1);
+ assert(*(d.end() - 1) == 3);
+ assert(*d.cbegin() == 1);
+ assert(*d.rbegin() == 3);
+ assert(*d.crbegin() == 3);
+ return true;
+}
+#endif
+
int main(int, char**) {
+#if TEST_STD_VER >= 26
+ assert(test_constexpr());
+ static_assert(test_constexpr());
+#endif
+
{
typedef std::deque<int> C;
C c;
diff --git a/libcxx/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp b/libcxx/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp
index dcf222267463c..5b05b8ef47533 100644
--- a/libcxx/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp
+++ b/libcxx/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp
@@ -35,7 +35,7 @@ TEST_CONSTEXPR_CXX17 void check_distance(It first, It last, typename std::iterat
}
#if TEST_STD_VER >= 20
-/*TEST_CONSTEXPR_CXX26*/ void test_deque() { // TODO: Mark as TEST_CONSTEXPR_CXX26 once std::deque is constexpr
+TEST_CONSTEXPR_CXX26 void test_deque() {
using Container = std::deque<std::deque<double>>;
Container c;
auto view = c | std::views::join;
@@ -74,7 +74,7 @@ TEST_CONSTEXPR_CXX17 bool tests() {
auto view = c | std::views::join;
assert(std::distance(view.begin(), view.end()) == 30);
}
- if (!TEST_IS_CONSTANT_EVALUATED) // TODO: Use TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED when std::deque is made constexpr
+ if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED)
test_deque();
#endif
return true;
diff --git a/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.distance/iterator_sentinel.pass.cpp b/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.distance/iterator_sentinel.pass.cpp
index c34d59e405a9e..753069384d53a 100644
--- a/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.distance/iterator_sentinel.pass.cpp
+++ b/libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.distance/iterator_sentinel.pass.cpp
@@ -171,7 +171,7 @@ constexpr void test_stride_counting() {
}
}
-/*TEST_CONSTEXPR_CXX26*/ void test_deque() { // TODO: Mark as TEST_CONSTEXPR_CXX26 once std::deque is constexpr
+TEST_CONSTEXPR_CXX26 void test_deque() {
using Container = std::deque<std::deque<double>>;
Container c;
auto view = c | std::views::join;
@@ -268,7 +268,7 @@ constexpr bool test() {
auto view = c | std::views::join;
assert(std::ranges::distance(view.begin(), view.end()) == 30);
}
- if (!TEST_IS_CONSTANT_EVALUATED) // TODO: Use TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED when std::deque is made constexpr
+ if (TEST_STD_AT_LEAST_26_OR_RUNTIME_EVALUATED)
test_deque();
return true;
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp
index b634f3253093e..81a7613639ea4 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/deque.version.compile.pass.cpp
@@ -24,6 +24,10 @@
# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
# endif
+# ifdef __cpp_lib_constexpr_deque
+# error "__cpp_lib_constexpr_deque 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
@@ -46,6 +50,10 @@
# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
# endif
+# ifdef __cpp_lib_constexpr_deque
+# error "__cpp_lib_constexpr_deque 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
@@ -71,6 +79,10 @@
# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
# endif
+# ifdef __cpp_lib_constexpr_deque
+# error "__cpp_lib_constexpr_deque 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
@@ -99,6 +111,10 @@
# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++20"
# endif
+# ifdef __cpp_lib_constexpr_deque
+# error "__cpp_lib_constexpr_deque 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
@@ -130,6 +146,10 @@
# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++23"
# endif
+# ifdef __cpp_lib_constexpr_deque
+# error "__cpp_lib_constexpr_deque should not be defined before c++26"
+# endif
+
# ifndef __cpp_lib_containers_ranges
# error "__cpp_lib_containers_ranges should be defined in c++23"
# endif
@@ -164,6 +184,13 @@
# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++26"
# endif
+# ifndef __cpp_lib_constexpr_deque
+# error "__cpp_lib_constexpr_deque should be defined in c++26"
+# endif
+# if __cpp_lib_constexpr_deque != 202502L
+# error "__cpp_lib_constexpr_deque should have the value 202502L in c++26"
+# endif
+
# ifndef __cpp_lib_containers_ranges
# error "__cpp_lib_containers_ranges should be defined in c++26"
# endif
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 dfee4b6d458db..adb463d0bb611 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
@@ -204,6 +204,10 @@
# error "__cpp_lib_constexpr_complex should not be defined before c++20"
# endif
+# ifdef __cpp_lib_constexpr_deque
+# error "__cpp_lib_constexpr_deque should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_constexpr_dynamic_alloc
# error "__cpp_lib_constexpr_dynamic_alloc should not be defined before c++20"
# endif
@@ -1136,6 +1140,10 @@
# error "__cpp_lib_constexpr_complex should not be defined before c++20"
# endif
+# ifdef __cpp_lib_constexpr_deque
+# error "__cpp_lib_constexpr_deque should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_constexpr_dynamic_alloc
# error "__cpp_lib_constexpr_dynamic_alloc should not be defined before c++20"
# endif
@@ -2170,6 +2178,10 @@
# error "__cpp_lib_constexpr_complex should not be defined before c++20"
# endif
+# ifdef __cpp_lib_constexpr_deque
+# error "__cpp_lib_constexpr_deque should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_constexpr_dynamic_alloc
# error "__cpp_lib_constexpr_dynamic_alloc should not be defined before c++20"
# endif
@@ -3435,6 +3447,10 @@
# error "__cpp_lib_constexpr_complex should have the value 201711L in c++20"
# endif
+# ifdef __cpp_lib_constexpr_deque
+# error "__cpp_lib_constexpr_deque should not be defined before c++26"
+# endif
+
# ifndef __cpp_lib_constexpr_dynamic_alloc
# error "__cpp_lib_constexpr_dynamic_alloc should be defined in c++20"
# endif
@@ -4925,6 +4941,10 @@
# error "__cpp_lib_constexpr_complex should have the value 201711L in c++23"
# endif
+# ifdef __cpp_lib_constexpr_deque
+# error "__cpp_lib_constexpr_deque should not be defined before c++26"
+# endif
+
# ifndef __cpp_lib_constexpr_dynamic_alloc
# error "__cpp_lib_constexpr_dynamic_alloc should be defined in c++23"
# endif
@@ -6634,6 +6654,13 @@
# error "__cpp_lib_constexpr_complex should have the value 201711L in c++26"
# endif
+# ifndef __cpp_lib_constexpr_deque
+# error "__cpp_lib_constexpr_deque should be defined in c++26"
+# endif
+# if __cpp_lib_constexpr_deque != 202502L
+# error "__cpp_lib_constexpr_deque should have the value 202502L in c++26"
+# endif
+
# ifndef __cpp_lib_constexpr_dynamic_alloc
# error "__cpp_lib_constexpr_dynamic_alloc should be defined in c++26"
# endif
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index f81eb0e0e8060..17c9b9b53d2b3 100644
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -370,6 +370,11 @@ def add_version_header(tc):
"values": {"c++20": 201711},
"headers": ["complex"],
},
+ {
+ "name": "__cpp_lib_constexpr_deque",
+ "values": {"c++26": 202502},
+ "headers": ["deque"],
+ },
{
"name": "__cpp_lib_constexpr_dynamic_alloc",
"values": {"c++20": 201907},
>From dae4785e3a67264adc3c2c23de35d0d6229ea11f Mon Sep 17 00:00:00 2001
From: Serosh-commits <janmejayapanda400 at gmail.com>
Date: Tue, 2 Jun 2026 04:47:30 +0530
Subject: [PATCH 2/2] fix the one test failure
---
libcxx/include/deque | 52 +++++++++++++++++--
.../flat.multimap.cons/iter_iter.pass.cpp | 1 +
2 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/libcxx/include/deque b/libcxx/include/deque
index 319c494bc01f1..b0e3f30d3055b 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -2329,7 +2329,18 @@ deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __
__bs = __n;
__fe = __fb + __bs;
}
- if (std::__is_pointer_in_range(__fb, __fe, __vt))
+ bool __in_range = false;
+ if (__libcpp_is_constant_evaluated()) {
+ for (const_pointer __tmp = __fb; __tmp != __fe; ++__tmp) {
+ if (__tmp == __vt) {
+ __in_range = true;
+ break;
+ }
+ }
+ } else {
+ __in_range = (__fb <= __vt && __vt < __fe);
+ }
+ if (__in_range)
__vt = (const_iterator(__f.__m_iter_, __vt) -= __f - __r).__ptr_;
__r = std::move(__fb, __fe, __r);
__n -= __bs;
@@ -2356,7 +2367,18 @@ deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, it
__bs = __n;
__lb = __le - __bs;
}
- if (std::__is_pointer_in_range(__lb, __le, __vt))
+ bool __in_range = false;
+ if (__libcpp_is_constant_evaluated()) {
+ for (const_pointer __tmp = __lb; __tmp != __le; ++__tmp) {
+ if (__tmp == __vt) {
+ __in_range = true;
+ break;
+ }
+ }
+ } else {
+ __in_range = (__lb <= __vt && __vt < __le);
+ }
+ if (__in_range)
__vt = (const_iterator(__l.__m_iter_, __vt) += __r - __l - 1).__ptr_;
__r = std::move_backward(__lb, __le, __r);
__n -= __bs;
@@ -2383,7 +2405,18 @@ deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l, i
__bs = __n;
__fe = __fb + __bs;
}
- if (std::__is_pointer_in_range(__fb, __fe, __vt))
+ bool __in_range = false;
+ if (__libcpp_is_constant_evaluated()) {
+ for (const_pointer __tmp = __fb; __tmp != __fe; ++__tmp) {
+ if (__tmp == __vt) {
+ __in_range = true;
+ break;
+ }
+ }
+ } else {
+ __in_range = (__fb <= __vt && __vt < __fe);
+ }
+ if (__in_range)
__vt = (const_iterator(__f.__m_iter_, __vt) += __r - __f).__ptr_;
for (; __fb != __fe; ++__fb, ++__r, ++__size())
__alloc_traits::construct(__a, std::addressof(*__r), std::move(*__fb));
@@ -2415,7 +2448,18 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 void deque<_Tp, _Allocator>::__move_construct_back
__bs = __n;
__lb = __le - __bs;
}
- if (std::__is_pointer_in_range(__lb, __le, __vt))
+ bool __in_range = false;
+ if (__libcpp_is_constant_evaluated()) {
+ for (const_pointer __tmp = __lb; __tmp != __le; ++__tmp) {
+ if (__tmp == __vt) {
+ __in_range = true;
+ break;
+ }
+ }
+ } else {
+ __in_range = (__lb <= __vt && __vt < __le);
+ }
+ if (__in_range)
__vt = (const_iterator(__l.__m_iter_, __vt) -= __l - __r + 1).__ptr_;
while (__le != __lb) {
__alloc_traits::construct(__a, std::addressof(*--__r), std::move(*--__le));
diff --git a/libcxx/test/std/containers/container.adaptors/flat.multimap/flat.multimap.cons/iter_iter.pass.cpp b/libcxx/test/std/containers/container.adaptors/flat.multimap/flat.multimap.cons/iter_iter.pass.cpp
index 46c8922350176..e5d8eb452cfa0 100644
--- a/libcxx/test/std/containers/container.adaptors/flat.multimap/flat.multimap.cons/iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/flat.multimap/flat.multimap.cons/iter_iter.pass.cpp
@@ -270,6 +270,7 @@ constexpr bool test() {
int main(int, char**) {
test();
#if TEST_STD_VER >= 26
+# pragma clang __debug constexpr_step_limit 10000000
static_assert(test());
#endif
More information about the libcxx-commits
mailing list