[libc++] Make <set> std::set constexpr as part of P3372R3 (#167241)
This commit is contained in:
parent
9a725a7e86
commit
475bc045b4
77 changed files with 934 additions and 351 deletions
|
|
@ -450,6 +450,8 @@ Status
|
|||
---------------------------------------------------------- -----------------
|
||||
``__cpp_lib_constexpr_queue`` ``202502L``
|
||||
---------------------------------------------------------- -----------------
|
||||
``__cpp_lib_constexpr_set`` ``202502L``
|
||||
---------------------------------------------------------- -----------------
|
||||
``__cpp_lib_constrained_equality`` ``202411L``
|
||||
---------------------------------------------------------- -----------------
|
||||
``__cpp_lib_copyable_function`` *unimplemented*
|
||||
|
|
|
|||
|
|
@ -169,7 +169,9 @@ template <class _NodeType, class _Derived>
|
|||
struct __set_node_handle_specifics {
|
||||
typedef typename _NodeType::__node_value_type value_type;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI value_type& value() const { return static_cast<_Derived const*>(this)->__ptr_->__get_value(); }
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_type& value() const {
|
||||
return static_cast<_Derived const*>(this)->__ptr_->__get_value();
|
||||
}
|
||||
};
|
||||
|
||||
template <class _NodeType, class _Derived>
|
||||
|
|
|
|||
|
|
@ -1511,7 +1511,7 @@ private:
|
|||
}
|
||||
|
||||
template <class _To, class _From, class _ValueT = _Tp, __enable_if_t<!__is_tree_value_type_v<_ValueT>, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI static void __assign_value(_To& __lhs, _From&& __rhs) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static void __assign_value(_To& __lhs, _From&& __rhs) {
|
||||
__lhs = std::forward<_From>(__rhs);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -615,24 +615,27 @@ public:
|
|||
template <class _Key2, class _Compare2, class _Alloc2>
|
||||
friend class multiset;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI set() _NOEXCEPT_(
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set() _NOEXCEPT_(
|
||||
is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
|
||||
is_nothrow_copy_constructible<key_compare>::value)
|
||||
: __tree_(value_compare()) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp) _NOEXCEPT_(
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit set(const value_compare& __comp) _NOEXCEPT_(
|
||||
is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
|
||||
: __tree_(__comp) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI explicit set(const value_compare& __comp, const allocator_type& __a) : __tree_(__comp, __a) {}
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 explicit set(const value_compare& __comp, const allocator_type& __a)
|
||||
: __tree_(__comp, __a) {}
|
||||
template <class _InputIterator>
|
||||
_LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
|
||||
set(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
|
||||
: __tree_(__comp) {
|
||||
insert(__f, __l);
|
||||
}
|
||||
|
||||
template <class _InputIterator>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
|
||||
set(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a)
|
||||
: __tree_(__comp, __a) {
|
||||
insert(__f, __l);
|
||||
|
|
@ -640,7 +643,7 @@ public:
|
|||
|
||||
# if _LIBCPP_STD_VER >= 23
|
||||
template <_ContainerCompatibleRange<value_type> _Range>
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
|
||||
set(from_range_t,
|
||||
_Range&& __range,
|
||||
const key_compare& __comp = key_compare(),
|
||||
|
|
@ -652,218 +655,278 @@ public:
|
|||
|
||||
# if _LIBCPP_STD_VER >= 14
|
||||
template <class _InputIterator>
|
||||
_LIBCPP_HIDE_FROM_ABI set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX26 set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
|
||||
: set(__f, __l, key_compare(), __a) {}
|
||||
# endif
|
||||
|
||||
# if _LIBCPP_STD_VER >= 23
|
||||
template <_ContainerCompatibleRange<value_type> _Range>
|
||||
_LIBCPP_HIDE_FROM_ABI set(from_range_t, _Range&& __range, const allocator_type& __a)
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(from_range_t, _Range&& __range, const allocator_type& __a)
|
||||
: set(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
|
||||
# endif
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI set(const set& __s) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(const set& __s) = default;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI set& operator=(const set& __s) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set& operator=(const set& __s) = default;
|
||||
|
||||
# ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_HIDE_FROM_ABI set(set&& __s) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(set&& __s) = default;
|
||||
# endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI explicit set(const allocator_type& __a) : __tree_(__a) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit set(const allocator_type& __a) : __tree_(__a) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI set(const set& __s, const allocator_type& __alloc) : __tree_(__s.__tree_, __alloc) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(const set& __s, const allocator_type& __alloc)
|
||||
: __tree_(__s.__tree_, __alloc) {}
|
||||
|
||||
# ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_HIDE_FROM_ABI set(set&& __s, const allocator_type& __alloc) : __tree_(std::move(__s.__tree_), __alloc) {}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(set&& __s, const allocator_type& __alloc)
|
||||
: __tree_(std::move(__s.__tree_), __alloc) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
|
||||
set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
|
||||
: __tree_(__comp) {
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a)
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
|
||||
set(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a)
|
||||
: __tree_(__comp, __a) {
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
# if _LIBCPP_STD_VER >= 14
|
||||
_LIBCPP_HIDE_FROM_ABI set(initializer_list<value_type> __il, const allocator_type& __a)
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set(initializer_list<value_type> __il, const allocator_type& __a)
|
||||
: set(__il, key_compare(), __a) {}
|
||||
# endif
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI set& operator=(initializer_list<value_type> __il) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set& operator=(initializer_list<value_type> __il) {
|
||||
clear();
|
||||
insert(__il.begin(), __il.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI set& operator=(set&& __s) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 set& operator=(set&& __s) = default;
|
||||
# endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI ~set() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~set() {
|
||||
static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), "");
|
||||
}
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT {
|
||||
return __tree_.begin();
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT {
|
||||
return __tree_.begin();
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT {
|
||||
return __tree_.end();
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT {
|
||||
return __tree_.end();
|
||||
}
|
||||
|
||||
[[__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_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT {
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 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_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT {
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 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 { return rbegin(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT {
|
||||
return begin();
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT {
|
||||
return end();
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator
|
||||
crbegin() const _NOEXCEPT {
|
||||
return rbegin();
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT {
|
||||
return rend();
|
||||
}
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT {
|
||||
return __tree_.size() == 0;
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT {
|
||||
return __tree_.size();
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT {
|
||||
return __tree_.max_size();
|
||||
}
|
||||
|
||||
// modifiers:
|
||||
# ifndef _LIBCPP_CXX03_LANG
|
||||
template <class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI pair<iterator, bool> emplace(_Args&&... __args) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> emplace(_Args&&... __args) {
|
||||
return __tree_.__emplace_unique(std::forward<_Args>(__args)...);
|
||||
}
|
||||
template <class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __p, _Args&&... __args) {
|
||||
return __tree_.__emplace_hint_unique(__p, std::forward<_Args>(__args)...).first;
|
||||
}
|
||||
# endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(const value_type& __v) { return __tree_.__emplace_unique(__v); }
|
||||
_LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(const value_type& __v) {
|
||||
return __tree_.__emplace_unique(__v);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) {
|
||||
return __tree_.__emplace_hint_unique(__p, __v).first;
|
||||
}
|
||||
|
||||
template <class _InputIterator>
|
||||
_LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __first, _InputIterator __last) {
|
||||
__tree_.__insert_range_unique(__first, __last);
|
||||
}
|
||||
|
||||
# if _LIBCPP_STD_VER >= 23
|
||||
template <_ContainerCompatibleRange<value_type> _Range>
|
||||
_LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) {
|
||||
__tree_.__insert_range_unique(ranges::begin(__range), ranges::end(__range));
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_HIDE_FROM_ABI pair<iterator, bool> insert(value_type&& __v) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, bool> insert(value_type&& __v) {
|
||||
return __tree_.__emplace_unique(std::move(__v));
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) {
|
||||
return __tree_.__emplace_hint_unique(__p, std::move(__v)).first;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) {
|
||||
insert(__il.begin(), __il.end());
|
||||
}
|
||||
# endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); }
|
||||
_LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_unique(__k); }
|
||||
_LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); }
|
||||
_LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) { return __tree_.erase(__p); }
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __k) {
|
||||
return __tree_.__erase_unique(__k);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l) {
|
||||
return __tree_.erase(__f, __l);
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); }
|
||||
|
||||
# if _LIBCPP_STD_VER >= 17
|
||||
_LIBCPP_HIDE_FROM_ABI insert_return_type insert(node_type&& __nh) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 insert_return_type insert(node_type&& __nh) {
|
||||
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
|
||||
"node_type with incompatible allocator passed to set::insert()");
|
||||
return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(std::move(__nh));
|
||||
}
|
||||
_LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, node_type&& __nh) {
|
||||
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
|
||||
"node_type with incompatible allocator passed to set::insert()");
|
||||
return __tree_.template __node_handle_insert_unique<node_type>(__hint, std::move(__nh));
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(key_type const& __key) {
|
||||
return __tree_.template __node_handle_extract<node_type>(__key);
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(const_iterator __it) {
|
||||
return __tree_.template __node_handle_extract<node_type>(__it);
|
||||
}
|
||||
template <class _Compare2>
|
||||
_LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>& __source) {
|
||||
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
|
||||
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
|
||||
__tree_.__node_handle_merge_unique(__source.__tree_);
|
||||
}
|
||||
template <class _Compare2>
|
||||
_LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>&& __source) {
|
||||
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
|
||||
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
|
||||
__tree_.__node_handle_merge_unique(__source.__tree_);
|
||||
}
|
||||
template <class _Compare2>
|
||||
_LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
|
||||
merge(multiset<key_type, _Compare2, allocator_type>& __source) {
|
||||
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
|
||||
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
|
||||
__tree_.__node_handle_merge_unique(__source.__tree_);
|
||||
}
|
||||
template <class _Compare2>
|
||||
_LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
|
||||
merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
|
||||
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
|
||||
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
|
||||
__tree_.__node_handle_merge_unique(__source.__tree_);
|
||||
}
|
||||
# endif
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { __tree_.swap(__s.__tree_); }
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
|
||||
__tree_.swap(__s.__tree_);
|
||||
}
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT {
|
||||
return __tree_.__alloc();
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const {
|
||||
return __tree_.value_comp();
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
|
||||
return __tree_.value_comp();
|
||||
}
|
||||
|
||||
// set operations:
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __k) {
|
||||
return __tree_.find(__k);
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __k) const {
|
||||
return __tree_.find(__k);
|
||||
}
|
||||
# if _LIBCPP_STD_VER >= 14
|
||||
template <typename _K2,
|
||||
class _Comp = _Compare,
|
||||
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _K2& __k) {
|
||||
return __tree_.find(__k);
|
||||
}
|
||||
template <typename _K2,
|
||||
class _Comp = _Compare,
|
||||
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _K2& __k) const {
|
||||
return __tree_.find(__k);
|
||||
}
|
||||
# endif
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __k) const {
|
||||
return __tree_.__count_unique(__k);
|
||||
}
|
||||
# if _LIBCPP_STD_VER >= 14
|
||||
template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _K2& __k) const {
|
||||
return __tree_.__count_multi(__k);
|
||||
}
|
||||
# endif
|
||||
|
||||
# if _LIBCPP_STD_VER >= 20
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __k) const {
|
||||
return find(__k) != end();
|
||||
}
|
||||
template <typename _K2,
|
||||
class _Comp = _Compare,
|
||||
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _K2& __k) const {
|
||||
return find(__k) != end();
|
||||
}
|
||||
# endif // _LIBCPP_STD_VER >= 20
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __k) {
|
||||
return __tree_.__lower_bound_unique(__k);
|
||||
}
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
|
||||
lower_bound(const key_type& __k) const {
|
||||
return __tree_.__lower_bound_unique(__k);
|
||||
}
|
||||
|
||||
|
|
@ -873,23 +936,25 @@ public:
|
|||
template <typename _K2,
|
||||
class _Comp = _Compare,
|
||||
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _K2& __k) {
|
||||
return __tree_.__lower_bound_multi(__k);
|
||||
}
|
||||
|
||||
template <typename _K2,
|
||||
class _Comp = _Compare,
|
||||
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
|
||||
lower_bound(const _K2& __k) const {
|
||||
return __tree_.__lower_bound_multi(__k);
|
||||
}
|
||||
# endif
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __k) {
|
||||
return __tree_.__upper_bound_unique(__k);
|
||||
}
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
|
||||
upper_bound(const key_type& __k) const {
|
||||
return __tree_.__upper_bound_unique(__k);
|
||||
}
|
||||
|
||||
|
|
@ -897,30 +962,35 @@ public:
|
|||
template <typename _K2,
|
||||
class _Comp = _Compare,
|
||||
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _K2& __k) {
|
||||
return __tree_.__upper_bound_multi(__k);
|
||||
}
|
||||
template <typename _K2,
|
||||
class _Comp = _Compare,
|
||||
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
|
||||
upper_bound(const _K2& __k) const {
|
||||
return __tree_.__upper_bound_multi(__k);
|
||||
}
|
||||
# endif
|
||||
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
|
||||
[[__nodiscard__]]
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __k) {
|
||||
return __tree_.__equal_range_unique(__k);
|
||||
}
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
|
||||
equal_range(const key_type& __k) const {
|
||||
return __tree_.__equal_range_unique(__k);
|
||||
}
|
||||
# if _LIBCPP_STD_VER >= 14
|
||||
template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
|
||||
[[__nodiscard__]]
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _K2& __k) {
|
||||
return __tree_.__equal_range_multi(__k);
|
||||
}
|
||||
template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
|
||||
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
|
||||
equal_range(const _K2& __k) const {
|
||||
return __tree_.__equal_range_multi(__k);
|
||||
}
|
||||
# endif
|
||||
|
|
@ -983,7 +1053,7 @@ struct __specialized_algorithm<_Alg, __single_range<set<_Key, _Compare, _Allocat
|
|||
|
||||
// set's begin() and end() are identical with and without const qualification
|
||||
template <class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI static auto operator()(const __set& __set, _Args&&... __args) {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto operator()(const __set& __set, _Args&&... __args) {
|
||||
return __specialized_algorithm<_Alg, __single_range<typename __set::__base>>()(
|
||||
__set.__tree_, std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
|
@ -991,7 +1061,7 @@ struct __specialized_algorithm<_Alg, __single_range<set<_Key, _Compare, _Allocat
|
|||
# endif
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
|
||||
operator==(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
|
||||
return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
|
||||
}
|
||||
|
|
@ -999,31 +1069,31 @@ operator==(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare,
|
|||
# if _LIBCPP_STD_VER <= 17
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
|
||||
operator<(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
|
||||
return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
|
||||
operator!=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
|
||||
operator>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
|
||||
return __y < __x;
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
|
||||
operator>=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI bool
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
|
||||
operator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
|
||||
return !(__y < __x);
|
||||
}
|
||||
|
|
@ -1031,7 +1101,7 @@ operator<=(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare,
|
|||
# else // _LIBCPP_STD_VER <= 17
|
||||
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<_Key>
|
||||
operator<=>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare, _Allocator>& __y) {
|
||||
return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way);
|
||||
}
|
||||
|
|
@ -1040,14 +1110,14 @@ operator<=>(const set<_Key, _Compare, _Allocator>& __x, const set<_Key, _Compare
|
|||
|
||||
// specialized algorithms:
|
||||
template <class _Key, class _Compare, class _Allocator>
|
||||
inline _LIBCPP_HIDE_FROM_ABI void swap(set<_Key, _Compare, _Allocator>& __x, set<_Key, _Compare, _Allocator>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
|
||||
swap(set<_Key, _Compare, _Allocator>& __x, set<_Key, _Compare, _Allocator>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
# if _LIBCPP_STD_VER >= 20
|
||||
template <class _Key, class _Compare, class _Allocator, class _Predicate>
|
||||
inline _LIBCPP_HIDE_FROM_ABI typename set<_Key, _Compare, _Allocator>::size_type
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename set<_Key, _Compare, _Allocator>::size_type
|
||||
erase_if(set<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
|
||||
return std::__libcpp_erase_if_container(__c, __pred);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ __cpp_lib_constexpr_memory 202202L <memory>
|
|||
__cpp_lib_constexpr_new 202406L <new>
|
||||
__cpp_lib_constexpr_numeric 201911L <numeric>
|
||||
__cpp_lib_constexpr_queue 202502L <queue>
|
||||
__cpp_lib_constexpr_set 202502L <set>
|
||||
__cpp_lib_constexpr_string 201907L <string>
|
||||
__cpp_lib_constexpr_string_view 201811L <string_view>
|
||||
__cpp_lib_constexpr_tuple 201811L <tuple>
|
||||
|
|
@ -575,6 +576,7 @@ __cpp_lib_void_t 201411L <type_traits>
|
|||
# define __cpp_lib_constexpr_new 202406L
|
||||
# endif
|
||||
# define __cpp_lib_constexpr_queue 202502L
|
||||
# define __cpp_lib_constexpr_set 202502L
|
||||
# define __cpp_lib_constrained_equality 202411L
|
||||
// # define __cpp_lib_copyable_function 202306L
|
||||
// # define __cpp_lib_debugging 202311L
|
||||
|
|
|
|||
|
|
@ -189,23 +189,23 @@ TEST_CONSTEXPR_CXX26 void test_node_container(Converter conv) {
|
|||
}
|
||||
|
||||
template <template <class> class Container>
|
||||
void test_invoke_set_like() {
|
||||
TEST_CONSTEXPR_CXX26 void test_invoke_set_like() {
|
||||
{ // check that std::invoke is used
|
||||
struct T {
|
||||
mutable int i = 3;
|
||||
|
||||
void zero() const { i = 0; }
|
||||
TEST_CONSTEXPR_CXX26 void zero() const { i = 0; }
|
||||
};
|
||||
|
||||
class S {
|
||||
int val_;
|
||||
|
||||
public:
|
||||
S(int val) : val_(val) {}
|
||||
TEST_CONSTEXPR_CXX26 S(int val) : val_(val) {}
|
||||
|
||||
T j;
|
||||
|
||||
bool operator<(const S& rhs) const { return val_ < rhs.val_; }
|
||||
TEST_CONSTEXPR_CXX26 bool operator<(const S& rhs) const { return val_ < rhs.val_; }
|
||||
};
|
||||
|
||||
{ // Iterator overload
|
||||
|
|
@ -253,23 +253,19 @@ TEST_CONSTEXPR_CXX26 void test_invoke_map_like() {
|
|||
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
// FIXME: remove when set is made constexpr
|
||||
test_node_container<std::set<int> >([](int i) { return i; });
|
||||
|
||||
// FIXME: remove when multiset is made constexpr
|
||||
test_node_container<std::multiset<int> >([](int i) { return i; });
|
||||
}
|
||||
test_node_container<std::set<int> >([](int i) { return i; });
|
||||
test_node_container<std::map<int, int> >([](int i) { return std::make_pair(i, i); });
|
||||
test_node_container<std::multimap<int, int> >([](int i) { return std::make_pair(i, i); });
|
||||
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
// FIXME: remove when set is made constexpr
|
||||
test_invoke_set_like<std::set>();
|
||||
|
||||
// FIXME: remove when multiset is made constexpr
|
||||
test_invoke_set_like<std::multiset>();
|
||||
}
|
||||
|
||||
test_invoke_set_like<std::set>();
|
||||
test_invoke_map_like<std::map>();
|
||||
test_invoke_map_like<std::multimap>();
|
||||
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ TEST_CONSTEXPR_CXX26 void test_associative_set() {
|
|||
}
|
||||
|
||||
template <template <class...> class Container>
|
||||
void test_associative_set_move_only() {
|
||||
TEST_CONSTEXPR_CXX26 void test_associative_set_move_only() {
|
||||
MoveOnly input[5];
|
||||
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
|
||||
|
||||
|
|
@ -252,8 +252,8 @@ void test_associative_set_move_only() {
|
|||
}
|
||||
|
||||
template <template <class...> class Container>
|
||||
void test_set_exception_safety_throwing_copy() {
|
||||
#if !defined(TEST_HAS_NO_EXCEPTIONS)
|
||||
TEST_CONSTEXPR_CXX26 void test_set_exception_safety_throwing_copy() {
|
||||
#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(TEST_IS_CONSTANT_EVALUATED)
|
||||
using T = ThrowingCopy<3>;
|
||||
T::reset();
|
||||
T in[5] = {{1}, {2}, {3}, {4}, {5}};
|
||||
|
|
@ -270,8 +270,8 @@ void test_set_exception_safety_throwing_copy() {
|
|||
}
|
||||
|
||||
template <template <class...> class Container, class T>
|
||||
void test_set_exception_safety_throwing_allocator() {
|
||||
#if !defined(TEST_HAS_NO_EXCEPTIONS)
|
||||
TEST_CONSTEXPR_CXX26 void test_set_exception_safety_throwing_allocator() {
|
||||
#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(TEST_IS_CONSTANT_EVALUATED)
|
||||
T in[] = {1, 2};
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// void clear() noexcept;
|
||||
// constexpr void clear() noexcept; // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<int> M;
|
||||
typedef int V;
|
||||
|
|
@ -42,5 +42,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,12 +11,14 @@
|
|||
#include <cassert>
|
||||
#include <set>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
// <set>
|
||||
|
||||
// bool contains(const key_type& x) const;
|
||||
// constexpr bool contains(const key_type& x) const; // constexpr since C++26
|
||||
|
||||
template <typename T, typename V, typename B, typename... Vals>
|
||||
void test(B bad, Vals... args) {
|
||||
TEST_CONSTEXPR_CXX26 void test(B bad, Vals... args) {
|
||||
T set;
|
||||
V vals[] = {args...};
|
||||
|
||||
|
|
@ -34,15 +36,22 @@ struct E {
|
|||
char c = 1;
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
test<std::set<int>, int>(14, 10, 11, 12, 13);
|
||||
test<std::set<char>, char>('e', 'a', 'b', 'c', 'd');
|
||||
}
|
||||
{
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
test<std::multiset<int>, int>(14, 10, 11, 12, 13);
|
||||
test<std::multiset<char>, char>('e', 'a', 'b', 'c', 'd');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,33 +12,45 @@
|
|||
|
||||
// class set
|
||||
|
||||
// template<typename K> bool contains(const K& x) const; // C++20
|
||||
// template<typename K> constexpr bool contains(const K& x) const; // C++20 // constexpr since C++26
|
||||
|
||||
#include <cassert>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
struct Comp {
|
||||
using is_transparent = void;
|
||||
|
||||
bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
|
||||
TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const {
|
||||
return lhs < rhs;
|
||||
}
|
||||
|
||||
bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
|
||||
TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
|
||||
|
||||
bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
|
||||
TEST_CONSTEXPR_CXX26 bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
|
||||
};
|
||||
|
||||
template <typename Container>
|
||||
void test() {
|
||||
TEST_CONSTEXPR_CXX26 void test() {
|
||||
Container s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}};
|
||||
|
||||
assert(s.contains(1));
|
||||
assert(!s.contains(-1));
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
test<std::set<std::pair<int, int>, Comp> >();
|
||||
test<std::multiset<std::pair<int, int>, Comp> >();
|
||||
if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
test<std::multiset<std::pair<int, int>, Comp> >();
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// size_type count(const key_type& k) const;
|
||||
// constexpr size_type count(const key_type& k) const; // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
#include "min_allocator.h"
|
||||
#include "private_constructor.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef int V;
|
||||
typedef std::set<int> M;
|
||||
|
|
@ -136,5 +136,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,27 +13,38 @@
|
|||
// class set
|
||||
|
||||
// template<typename K>
|
||||
// size_type count(const K& x) const; // C++14
|
||||
// constexpr size_type count(const K& x) const; // C++14 // constexpr since C++26
|
||||
|
||||
#include <cassert>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
struct Comp {
|
||||
using is_transparent = void;
|
||||
|
||||
bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
|
||||
TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const {
|
||||
return lhs < rhs;
|
||||
}
|
||||
|
||||
bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
|
||||
TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
|
||||
|
||||
bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
|
||||
TEST_CONSTEXPR_CXX26 bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::set<std::pair<int, int>, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}};
|
||||
|
||||
auto cnt = s.count(1);
|
||||
assert(cnt == 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
// class set
|
||||
|
||||
// template <class... Args>
|
||||
// pair<iterator, bool> emplace(Args&&... args);
|
||||
// constexpr pair<iterator, bool> emplace(Args&&... args); // constexpr since C++26
|
||||
|
||||
#include <cassert>
|
||||
#include <set>
|
||||
|
|
@ -23,8 +23,8 @@
|
|||
#include "MoveOnly.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
{
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
typedef std::set<DefaultOnly> M;
|
||||
typedef std::pair<M::iterator, bool> R;
|
||||
M m;
|
||||
|
|
@ -43,7 +43,8 @@ int main(int, char**) {
|
|||
assert(*m.begin() == DefaultOnly());
|
||||
assert(DefaultOnly::count == 1);
|
||||
}
|
||||
assert(DefaultOnly::count == 0);
|
||||
if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
assert(DefaultOnly::count == 0);
|
||||
{
|
||||
typedef std::set<Emplaceable> M;
|
||||
typedef std::pair<M::iterator, bool> R;
|
||||
|
|
@ -92,5 +93,12 @@ int main(int, char**) {
|
|||
assert(set.begin() == std::get<0>(res));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
// class set
|
||||
|
||||
// template <class... Args>
|
||||
// iterator emplace_hint(const_iterator position, Args&&... args);
|
||||
// constexpr iterator emplace_hint(const_iterator position, Args&&... args); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -23,8 +23,8 @@
|
|||
#include "DefaultOnly.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
{
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
typedef std::set<DefaultOnly> M;
|
||||
typedef M::iterator R;
|
||||
M m;
|
||||
|
|
@ -41,7 +41,8 @@ int main(int, char**) {
|
|||
assert(*m.begin() == DefaultOnly());
|
||||
assert(DefaultOnly::count == 1);
|
||||
}
|
||||
assert(DefaultOnly::count == 0);
|
||||
if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
assert(DefaultOnly::count == 0);
|
||||
{
|
||||
typedef std::set<Emplaceable> M;
|
||||
typedef M::iterator R;
|
||||
|
|
@ -78,5 +79,12 @@ int main(int, char**) {
|
|||
assert(*r == 2);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// bool empty() const;
|
||||
// constexpr bool empty() const; // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<int> M;
|
||||
M m;
|
||||
|
|
@ -40,5 +40,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
// class set
|
||||
|
||||
// pair<iterator,iterator> equal_range(const key_type& k);
|
||||
// pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
|
||||
// constexpr pair<iterator,iterator> equal_range(const key_type& k); // constexpr since C++26
|
||||
// constexpr pair<const_iterator,const_iterator> equal_range(const key_type& k) const; // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
#include "min_allocator.h"
|
||||
#include "private_constructor.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef int V;
|
||||
typedef std::set<int> M;
|
||||
|
|
@ -327,5 +327,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,27 +13,31 @@
|
|||
// class set
|
||||
|
||||
// template<typename K>
|
||||
// pair<iterator,iterator> equal_range(const K& x); //
|
||||
// C++14
|
||||
// constexpr pair<iterator,iterator> equal_range(const K& x); //
|
||||
// C++14, constexpr since C++26
|
||||
// template<typename K>
|
||||
// pair<const_iterator,const_iterator> equal_range(const K& x) const; //
|
||||
// C++14
|
||||
// constexpr pair<const_iterator,const_iterator> equal_range(const K& x) const; //
|
||||
// C++14, constexpr since C++26
|
||||
|
||||
#include <cassert>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
struct Comp {
|
||||
using is_transparent = void;
|
||||
|
||||
bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
|
||||
TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const {
|
||||
return lhs < rhs;
|
||||
}
|
||||
|
||||
bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
|
||||
TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
|
||||
|
||||
bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
|
||||
TEST_CONSTEXPR_CXX26 bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::set<std::pair<int, int>, Comp> s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}};
|
||||
|
||||
auto er = s.equal_range(1);
|
||||
|
|
@ -46,5 +50,12 @@ int main(int, char**) {
|
|||
|
||||
assert(nels == 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// iterator erase(const_iterator position);
|
||||
// constexpr iterator erase(const_iterator position); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -20,12 +20,12 @@
|
|||
|
||||
struct TemplateConstructor {
|
||||
template <typename T>
|
||||
TemplateConstructor(const T&) {}
|
||||
TEST_CONSTEXPR_CXX26 TemplateConstructor(const T&) {}
|
||||
};
|
||||
|
||||
bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
|
||||
TEST_CONSTEXPR_CXX26 bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<int> M;
|
||||
typedef int V;
|
||||
|
|
@ -179,5 +179,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// iterator erase(const_iterator first, const_iterator last);
|
||||
// constexpr iterator erase(const_iterator first, const_iterator last); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<int> M;
|
||||
typedef int V;
|
||||
|
|
@ -118,5 +118,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// size_type erase(const key_type& k);
|
||||
// constexpr size_type erase(const key_type& k); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<int> M;
|
||||
typedef int V;
|
||||
|
|
@ -180,5 +180,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// node_type extract(const_iterator);
|
||||
// constexpr node_type extract(const_iterator); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include "test_macros.h"
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
#include "Counter.h"
|
||||
|
||||
template <class Container>
|
||||
void test(Container& c) {
|
||||
TEST_CONSTEXPR_CXX26 void test(Container& c) {
|
||||
std::size_t sz = c.size();
|
||||
|
||||
for (auto first = c.cbegin(); first != c.cend();) {
|
||||
|
|
@ -35,14 +35,14 @@ void test(Container& c) {
|
|||
assert(c.size() == 0);
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
using set_type = std::set<int>;
|
||||
set_type m = {1, 2, 3, 4, 5, 6};
|
||||
test(m);
|
||||
}
|
||||
|
||||
{
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
std::set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
|
||||
assert(Counter_base::gConstructed == 6);
|
||||
test(m);
|
||||
|
|
@ -55,5 +55,12 @@ int main(int, char**) {
|
|||
test(m);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// node_type extract(key_type const&);
|
||||
// constexpr node_type extract(key_type const&); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include "test_macros.h"
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
#include "Counter.h"
|
||||
|
||||
template <class Container, class KeyTypeIter>
|
||||
void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
|
||||
TEST_CONSTEXPR_CXX26 void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
|
||||
std::size_t sz = c.size();
|
||||
assert((std::size_t)std::distance(first, last) == sz);
|
||||
|
||||
|
|
@ -41,14 +41,14 @@ void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
|
|||
}
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
std::set<int> m = {1, 2, 3, 4, 5, 6};
|
||||
int keys[] = {1, 2, 3, 4, 5, 6};
|
||||
test(m, std::begin(keys), std::end(keys));
|
||||
}
|
||||
|
||||
{
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
std::set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
|
||||
{
|
||||
Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
|
||||
|
|
@ -65,5 +65,12 @@ int main(int, char**) {
|
|||
test(m, std::begin(keys), std::end(keys));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
// class set
|
||||
|
||||
// iterator find(const key_type& k);
|
||||
// const_iterator find(const key_type& k) const;
|
||||
// constexpr iterator find(const key_type& k); // constexpr since C++26
|
||||
// constexpr const_iterator find(const key_type& k) const; // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
#include "min_allocator.h"
|
||||
#include "private_constructor.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef int V;
|
||||
typedef std::set<int> M;
|
||||
|
|
@ -202,5 +202,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// allocator_type get_allocator() const
|
||||
// constexpr allocator_type get_allocator() const // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "test_allocator.h"
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
std::allocator<int> alloc;
|
||||
const std::set<int> s(alloc);
|
||||
|
|
@ -29,5 +29,12 @@ int main(int, char**) {
|
|||
const std::set<int, std::less<int>, other_allocator<int> > s(alloc);
|
||||
assert(s.get_allocator() == alloc);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <set>
|
||||
// <set> // constexpr since C++26
|
||||
|
||||
// Check that std::set and its iterators can be instantiated with an incomplete
|
||||
// type.
|
||||
|
|
@ -25,8 +25,15 @@ struct A {
|
|||
|
||||
inline bool operator==(A const& L, A const& R) { return &L == &R; }
|
||||
inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
A a;
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// pair<iterator, bool> insert(const value_type& v);
|
||||
// constexpr pair<iterator, bool> insert(const value_type& v); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
#include "min_allocator.h"
|
||||
|
||||
template <class Container>
|
||||
void do_insert_cv_test() {
|
||||
TEST_CONSTEXPR_CXX26 void do_insert_cv_test() {
|
||||
typedef Container M;
|
||||
typedef std::pair<typename M::iterator, bool> R;
|
||||
typedef typename M::value_type VT;
|
||||
|
|
@ -53,7 +53,7 @@ void do_insert_cv_test() {
|
|||
assert(*r.first == 3);
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
do_insert_cv_test<std::set<int> >();
|
||||
#if TEST_STD_VER >= 11
|
||||
{
|
||||
|
|
@ -62,5 +62,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// void insert(initializer_list<value_type> il);
|
||||
// constexpr void insert(initializer_list<value_type> il); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<int> C;
|
||||
typedef C::value_type V;
|
||||
|
|
@ -57,5 +57,12 @@ int main(int, char**) {
|
|||
assert(*++i == V(10));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// iterator insert(const_iterator position, const value_type& v);
|
||||
// constexpr iterator insert(const_iterator position, const value_type& v); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<int> M;
|
||||
typedef M::iterator R;
|
||||
|
|
@ -70,5 +70,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// class set
|
||||
|
||||
// template <class InputIterator>
|
||||
// void insert(InputIterator first, InputIterator last);
|
||||
// constexpr void insert(InputIterator first, InputIterator last); // constexpr since C++26
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
#include "test_iterators.h"
|
||||
|
||||
template <class Iter, class Alloc>
|
||||
void test_alloc() {
|
||||
TEST_CONSTEXPR_CXX26 void test_alloc() {
|
||||
{ // Check that an empty range works correctly
|
||||
{ // Without elements in the container
|
||||
using Map = std::set<int, std::less<int>, Alloc>;
|
||||
|
|
@ -178,13 +178,16 @@ void test_alloc() {
|
|||
}
|
||||
}
|
||||
|
||||
void test() {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
test_alloc<cpp17_input_iterator<int*>, std::allocator<int> >();
|
||||
test_alloc<cpp17_input_iterator<int*>, min_allocator<int> >();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// iterator insert(const_iterator position, value_type&& v);
|
||||
// constexpr iterator insert(const_iterator position, value_type&& v); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
#include "MoveOnly.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<MoveOnly> M;
|
||||
typedef M::iterator R;
|
||||
|
|
@ -72,5 +72,12 @@ int main(int, char**) {
|
|||
assert(*r == 3);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// insert_return_type insert(node_type&&);
|
||||
// constexpr insert_return_type insert(node_type&&); // constexpr since C++26
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
#include "min_allocator.h"
|
||||
|
||||
template <class Container, class T>
|
||||
void verify_insert_return_type(T&& t) {
|
||||
TEST_CONSTEXPR_CXX26 void verify_insert_return_type(T&& t) {
|
||||
using verified_type = std::remove_cv_t<std::remove_reference_t<T>>;
|
||||
static_assert(std::is_aggregate_v<verified_type>);
|
||||
static_assert(std::is_same_v<verified_type, typename Container::insert_return_type>);
|
||||
|
|
@ -42,19 +42,20 @@ void verify_insert_return_type(T&& t) {
|
|||
}
|
||||
|
||||
template <class Container>
|
||||
typename Container::node_type node_factory(typename Container::key_type const& key) {
|
||||
static Container c;
|
||||
TEST_CONSTEXPR_CXX26 typename Container::node_type node_factory(Container& c, typename Container::key_type const& key) {
|
||||
auto p = c.insert(key);
|
||||
assert(p.second);
|
||||
return c.extract(p.first);
|
||||
}
|
||||
|
||||
template <class Container>
|
||||
void test(Container& c) {
|
||||
TEST_CONSTEXPR_CXX26 void test(Container& c) {
|
||||
auto* nf = &node_factory<Container>;
|
||||
|
||||
Container c2;
|
||||
|
||||
for (int i = 0; i != 10; ++i) {
|
||||
typename Container::node_type node = nf(i);
|
||||
typename Container::node_type node = nf(c2, i);
|
||||
assert(!node.empty());
|
||||
typename Container::insert_return_type irt = c.insert(std::move(node));
|
||||
assert(node.empty());
|
||||
|
|
@ -77,7 +78,7 @@ void test(Container& c) {
|
|||
}
|
||||
|
||||
{ // Insert duplicate node.
|
||||
typename Container::node_type dupl = nf(0);
|
||||
typename Container::node_type dupl = nf(c2, 0);
|
||||
auto irt = c.insert(std::move(dupl));
|
||||
assert(dupl.empty());
|
||||
assert(!irt.inserted);
|
||||
|
|
@ -94,11 +95,18 @@ void test(Container& c) {
|
|||
}
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::set<int> m;
|
||||
test(m);
|
||||
std::set<int, std::less<int>, min_allocator<int>> m2;
|
||||
test(m2);
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,26 +12,27 @@
|
|||
|
||||
// class set
|
||||
|
||||
// iterator insert(const_iterator hint, node_type&&);
|
||||
// constexpr iterator insert(const_iterator hint, node_type&&); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
template <class Container>
|
||||
typename Container::node_type node_factory(typename Container::key_type const& key) {
|
||||
static Container c;
|
||||
TEST_CONSTEXPR_CXX26 typename Container::node_type node_factory(Container& c, typename Container::key_type const& key) {
|
||||
auto p = c.insert(key);
|
||||
assert(p.second);
|
||||
return c.extract(p.first);
|
||||
}
|
||||
|
||||
template <class Container>
|
||||
void test(Container& c) {
|
||||
TEST_CONSTEXPR_CXX26 void test(Container& c) {
|
||||
auto* nf = &node_factory<Container>;
|
||||
|
||||
Container c2;
|
||||
|
||||
for (int i = 0; i != 10; ++i) {
|
||||
typename Container::node_type node = nf(i);
|
||||
typename Container::node_type node = nf(c2, i);
|
||||
assert(!node.empty());
|
||||
std::size_t prev = c.size();
|
||||
auto it = c.insert(c.end(), std::move(node));
|
||||
|
|
@ -47,11 +48,18 @@ void test(Container& c) {
|
|||
}
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
std::set<int> m;
|
||||
test(m);
|
||||
std::set<int, std::less<int>, min_allocator<int>> m2;
|
||||
test(m2);
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,18 +9,19 @@
|
|||
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
|
||||
// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC.
|
||||
// ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-missing-field-initializers
|
||||
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=2147483647
|
||||
|
||||
// <set>
|
||||
|
||||
// template<container-compatible-range<value_type> R>
|
||||
// void insert_range(R&& rg); // C++23
|
||||
// constexpr void insert_range(R&& rg); // C++23, constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "../../insert_range_maps_sets.h"
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
for_all_iterators_and_allocators<int, const int*>([]<class Iter, class Sent, class Alloc>() {
|
||||
test_map_set_insert_range<std::set<int, test_less<int>, Alloc>, int, Iter, Sent>();
|
||||
});
|
||||
|
|
@ -32,5 +33,12 @@ int main(int, char**) {
|
|||
test_set_insert_range_exception_safety_throwing_copy<std::set>();
|
||||
test_assoc_set_insert_range_exception_safety_throwing_allocator<std::set, int>();
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// pair<iterator, bool> insert(value_type&& v);
|
||||
// constexpr pair<iterator, bool> insert(value_type&& v); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
#include "MoveOnly.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<MoveOnly> M;
|
||||
typedef std::pair<M::iterator, bool> R;
|
||||
|
|
@ -79,5 +79,12 @@ int main(int, char**) {
|
|||
assert(*r.first == 3);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,20 +10,20 @@
|
|||
|
||||
// class set
|
||||
|
||||
// iterator begin();
|
||||
// const_iterator begin() const;
|
||||
// iterator end();
|
||||
// const_iterator end() const;
|
||||
// constexpr iterator begin(); // constexpr since C++26
|
||||
// constexpr const_iterator begin() const; // constexpr since C++26
|
||||
// constexpr iterator end(); // constexpr since C++26
|
||||
// constexpr const_iterator end() const; // constexpr since C++26
|
||||
//
|
||||
// reverse_iterator rbegin();
|
||||
// const_reverse_iterator rbegin() const;
|
||||
// reverse_iterator rend();
|
||||
// const_reverse_iterator rend() const;
|
||||
// constexpr reverse_iterator rbegin(); // constexpr since C++26
|
||||
// constexpr const_reverse_iterator rbegin() const; // constexpr since C++26
|
||||
// constexpr reverse_iterator rend(); // constexpr since C++26
|
||||
// constexpr const_reverse_iterator rend() const; // constexpr since C++26
|
||||
//
|
||||
// const_iterator cbegin() const;
|
||||
// const_iterator cend() const;
|
||||
// const_reverse_iterator crbegin() const;
|
||||
// const_reverse_iterator crend() const;
|
||||
// constexpr const_iterator cbegin() const; // constexpr since C++26
|
||||
// constexpr const_iterator cend() const; // constexpr since C++26
|
||||
// constexpr const_reverse_iterator crbegin() const; // constexpr since C++26
|
||||
// constexpr const_reverse_iterator crend() const; // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef int V;
|
||||
V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8};
|
||||
|
|
@ -129,5 +129,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
// class set
|
||||
|
||||
// iterator lower_bound(const key_type& k);
|
||||
// const_iterator lower_bound(const key_type& k) const;
|
||||
// constexpr iterator lower_bound(const key_type& k); // constexpr since C++26
|
||||
// constexpr const_iterator lower_bound(const key_type& k) const; // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
#include "min_allocator.h"
|
||||
#include "private_constructor.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef int V;
|
||||
typedef std::set<int> M;
|
||||
|
|
@ -283,5 +283,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// size_type max_size() const;
|
||||
// constexpr size_type max_size() const; // constexpr since C++26
|
||||
|
||||
#include <cassert>
|
||||
#include <limits>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
#include "test_allocator.h"
|
||||
#include "test_macros.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef limited_allocator<int, 10> A;
|
||||
typedef std::set<int, std::less<int>, A> C;
|
||||
|
|
@ -44,5 +44,12 @@ int main(int, char**) {
|
|||
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@
|
|||
// class set
|
||||
|
||||
// template <class C2>
|
||||
// void merge(set<key_type, C2, allocator_type>& source);
|
||||
// constexpr void merge(set<key_type, C2, allocator_type>& source); // constexpr since C++26
|
||||
// template <class C2>
|
||||
// void merge(set<key_type, C2, allocator_type>&& source);
|
||||
// constexpr void merge(set<key_type, C2, allocator_type>&& source); // constexpr since C++26
|
||||
// template <class C2>
|
||||
// void merge(multiset<key_type, C2, allocator_type>& source);
|
||||
// constexpr void merge(multiset<key_type, C2, allocator_type>& source); // constexpr since C++26
|
||||
// template <class C2>
|
||||
// void merge(multiset<key_type, C2, allocator_type>&& source);
|
||||
// constexpr void merge(multiset<key_type, C2, allocator_type>&& source); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
#include "Counter.h"
|
||||
|
||||
template <class Set>
|
||||
bool set_equal(const Set& set, Set other) {
|
||||
TEST_CONSTEXPR_CXX26 bool set_equal(const Set& set, Set other) {
|
||||
return set == other;
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ struct throw_comparator {
|
|||
};
|
||||
#endif
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
std::set<int> src{1, 3, 5};
|
||||
std::set<int> dst{2, 4, 5};
|
||||
|
|
@ -55,8 +55,8 @@ int main(int, char**) {
|
|||
assert(set_equal(dst, {1, 2, 3, 4, 5}));
|
||||
}
|
||||
|
||||
#ifndef TEST_HAS_NO_EXCEPTIONS
|
||||
{
|
||||
#if !defined(TEST_HAS_NO_EXCEPTIONS)
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
bool do_throw = false;
|
||||
typedef std::set<Counter<int>, throw_comparator> set_type;
|
||||
set_type src({1, 3, 5}, throw_comparator(do_throw));
|
||||
|
|
@ -75,13 +75,14 @@ int main(int, char**) {
|
|||
assert(set_equal(dst, set_type({2, 4, 5}, throw_comparator(do_throw))));
|
||||
}
|
||||
#endif
|
||||
assert(Counter_base::gConstructed == 0);
|
||||
if (!TEST_IS_CONSTANT_EVALUATED)
|
||||
assert(Counter_base::gConstructed == 0);
|
||||
struct comparator {
|
||||
comparator() = default;
|
||||
|
||||
bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const { return lhs < rhs; }
|
||||
};
|
||||
{
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
typedef std::set<Counter<int>, std::less<Counter<int>>> first_set_type;
|
||||
typedef std::set<Counter<int>, comparator> second_set_type;
|
||||
typedef std::multiset<Counter<int>, comparator> third_set_type;
|
||||
|
|
@ -128,11 +129,18 @@ int main(int, char**) {
|
|||
first.merge(second);
|
||||
first.merge(std::move(second));
|
||||
}
|
||||
{
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
std::multiset<int> second;
|
||||
first.merge(second);
|
||||
first.merge(std::move(second));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// set(const allocator_type& a);
|
||||
// constexpr set(const allocator_type& a); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "test_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef std::less<int> C;
|
||||
typedef test_allocator<int> A;
|
||||
std::set<int, C, A> m(A(5));
|
||||
|
|
@ -26,5 +26,12 @@ int main(int, char**) {
|
|||
assert(m.begin() == m.end());
|
||||
assert(m.get_allocator() == A(5));
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// set& operator=(initializer_list<value_type> il);
|
||||
// constexpr set& operator=(initializer_list<value_type> il); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
#include "min_allocator.h"
|
||||
#include "test_allocator.h"
|
||||
|
||||
void basic_test() {
|
||||
TEST_CONSTEXPR_CXX26 void basic_test() {
|
||||
{
|
||||
typedef std::set<int> C;
|
||||
typedef C::value_type V;
|
||||
|
|
@ -54,7 +54,7 @@ void basic_test() {
|
|||
}
|
||||
}
|
||||
|
||||
void duplicate_keys_test() {
|
||||
TEST_CONSTEXPR_CXX26 void duplicate_keys_test() {
|
||||
test_allocator_statistics alloc_stats;
|
||||
typedef std::set<int, std::less<int>, test_allocator<int> > Set;
|
||||
{
|
||||
|
|
@ -69,9 +69,16 @@ void duplicate_keys_test() {
|
|||
LIBCPP_ASSERT(alloc_stats.alloc_count == 0);
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
basic_test();
|
||||
duplicate_keys_test();
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// explicit set(const key_compare& comp) const;
|
||||
// constexpr explicit set(const key_compare& comp) const; // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "../../../test_compare.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef test_less<int> C;
|
||||
const std::set<int, C> m(C(3));
|
||||
assert(m.empty());
|
||||
|
|
@ -26,5 +26,12 @@ int main(int, char**) {
|
|||
assert(m.key_comp() == C(3));
|
||||
assert(m.value_comp() == C(3));
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// set(const value_compare& comp, const allocator_type& a);
|
||||
// constexpr set(const value_compare& comp, const allocator_type& a); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
#include "../../../test_compare.h"
|
||||
#include "test_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef test_less<int> C;
|
||||
typedef test_allocator<int> A;
|
||||
std::set<int, C, A> m(C(4), A(5));
|
||||
|
|
@ -28,5 +28,12 @@ int main(int, char**) {
|
|||
assert(m.key_comp() == C(4));
|
||||
assert(m.get_allocator() == A(5));
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// set(const set& m);
|
||||
// constexpr set(const set& m); // constexpr since C++26
|
||||
|
||||
#include <cassert>
|
||||
#include <set>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
#include "test_allocator.h"
|
||||
|
||||
template <template <class> class Alloc>
|
||||
void test_alloc() {
|
||||
TEST_CONSTEXPR_CXX26 void test_alloc() {
|
||||
{ // Simple check
|
||||
using Set = std::set<int, std::less<int>, Alloc<int> >;
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ void test_alloc() {
|
|||
}
|
||||
}
|
||||
|
||||
void test() {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
test_alloc<std::allocator>();
|
||||
test_alloc<min_allocator>(); // Make sure that fancy pointers work
|
||||
|
||||
|
|
@ -125,10 +125,13 @@ void test() {
|
|||
assert(orig.size() == 3);
|
||||
assert(orig.get_allocator() == other_allocator<int>(10));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// set(const set& m, const allocator_type& a);
|
||||
// constexpr set(const set& m, const allocator_type& a); // constexpr since C++26
|
||||
|
||||
#include <cassert>
|
||||
#include <set>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
#include "test_allocator.h"
|
||||
|
||||
template <class Alloc>
|
||||
void test_alloc(const Alloc& new_alloc) {
|
||||
TEST_CONSTEXPR_CXX26 void test_alloc(const Alloc& new_alloc) {
|
||||
{ // Simple check
|
||||
using Set = std::set<int, std::less<int>, Alloc>;
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ void test_alloc(const Alloc& new_alloc) {
|
|||
}
|
||||
}
|
||||
|
||||
void test() {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
test_alloc(std::allocator<int>());
|
||||
test_alloc(test_allocator<int>(25)); // Make sure that the new allocator is actually used
|
||||
test_alloc(min_allocator<int>()); // Make sure that fancy pointers work
|
||||
|
|
@ -97,10 +97,13 @@ void test() {
|
|||
assert(orig.size() == 3);
|
||||
assert(orig.key_comp() == test_less<int>(3));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// set& operator=(const set& s);
|
||||
// constexpr set& operator=(const set& s); // constexpr since C++26
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
|
@ -35,41 +35,42 @@ public:
|
|||
using value_type = T;
|
||||
using propagate_on_container_copy_assignment = std::true_type;
|
||||
|
||||
tracking_allocator(std::vector<void*>& allocs) : allocs_(&allocs) {}
|
||||
TEST_CONSTEXPR_CXX26 tracking_allocator(std::vector<void*>& allocs) : allocs_(&allocs) {}
|
||||
|
||||
template <class U>
|
||||
tracking_allocator(const tracking_allocator<U>& other) : allocs_(other.allocs_) {}
|
||||
TEST_CONSTEXPR_CXX26 tracking_allocator(const tracking_allocator<U>& other) : allocs_(other.allocs_) {}
|
||||
|
||||
T* allocate(std::size_t n) {
|
||||
TEST_CONSTEXPR_CXX26 T* allocate(std::size_t n) {
|
||||
T* allocation = std::allocator<T>().allocate(n);
|
||||
allocs_->push_back(allocation);
|
||||
return allocation;
|
||||
}
|
||||
|
||||
void deallocate(T* ptr, std::size_t n) TEST_NOEXCEPT {
|
||||
TEST_CONSTEXPR_CXX26 void deallocate(T* ptr, std::size_t n) TEST_NOEXCEPT {
|
||||
auto res = std::remove(allocs_->begin(), allocs_->end(), ptr);
|
||||
assert(res != allocs_->end() && "Trying to deallocate memory from different allocator?");
|
||||
allocs_->erase(res);
|
||||
std::allocator<T>().deallocate(ptr, n);
|
||||
}
|
||||
|
||||
friend bool operator==(const tracking_allocator& lhs, const tracking_allocator& rhs) {
|
||||
TEST_CONSTEXPR_CXX26 friend bool operator==(const tracking_allocator& lhs, const tracking_allocator& rhs) {
|
||||
return lhs.allocs_ == rhs.allocs_;
|
||||
}
|
||||
|
||||
friend bool operator!=(const tracking_allocator& lhs, const tracking_allocator& rhs) {
|
||||
TEST_CONSTEXPR_CXX26 friend bool operator!=(const tracking_allocator& lhs, const tracking_allocator& rhs) {
|
||||
return lhs.allocs_ != rhs.allocs_;
|
||||
}
|
||||
};
|
||||
|
||||
struct NoOp {
|
||||
void operator()() {}
|
||||
TEST_CONSTEXPR_CXX26 void operator()() {}
|
||||
};
|
||||
|
||||
template <class Alloc, class AllocatorInvariant = NoOp>
|
||||
void test_alloc(const Alloc& lhs_alloc = Alloc(),
|
||||
const Alloc& rhs_alloc = Alloc(),
|
||||
AllocatorInvariant check_alloc_invariant = NoOp()) {
|
||||
TEST_CONSTEXPR_CXX26 void
|
||||
test_alloc(const Alloc& lhs_alloc = Alloc(),
|
||||
const Alloc& rhs_alloc = Alloc(),
|
||||
AllocatorInvariant check_alloc_invariant = NoOp()) {
|
||||
{ // Test empty/non-empty set combinations
|
||||
{ // assign from a non-empty container into an empty one
|
||||
using Set = std::set<int, std::less<int>, Alloc>;
|
||||
|
|
@ -236,7 +237,7 @@ void test_alloc(const Alloc& lhs_alloc = Alloc(),
|
|||
}
|
||||
}
|
||||
|
||||
void test() {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
test_alloc<std::allocator<int> >();
|
||||
#if TEST_STD_VER >= 11
|
||||
test_alloc<min_allocator<int> >();
|
||||
|
|
@ -248,10 +249,10 @@ void test() {
|
|||
std::vector<void*>* rhs_allocs_;
|
||||
|
||||
public:
|
||||
AssertEmpty(std::vector<void*>& lhs_allocs, std::vector<void*>& rhs_allocs)
|
||||
TEST_CONSTEXPR_CXX26 AssertEmpty(std::vector<void*>& lhs_allocs, std::vector<void*>& rhs_allocs)
|
||||
: lhs_allocs_(&lhs_allocs), rhs_allocs_(&rhs_allocs) {}
|
||||
|
||||
void operator()() {
|
||||
TEST_CONSTEXPR_CXX26 void operator()() {
|
||||
assert(lhs_allocs_->empty());
|
||||
assert(rhs_allocs_->empty());
|
||||
}
|
||||
|
|
@ -275,10 +276,13 @@ void test() {
|
|||
assert(orig.size() == 3);
|
||||
assert(orig.key_comp() == test_less<int>(3));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@
|
|||
// set(from_range_t, R&&, Allocator)
|
||||
// -> set<ranges::range_value_t<R>, less<ranges::range_value_t<R>>, Allocator>; // C++23
|
||||
|
||||
// constexpr since C++26
|
||||
|
||||
#include <algorithm> // std::equal
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
|
@ -49,10 +51,10 @@
|
|||
#include "test_allocator.h"
|
||||
|
||||
struct NotAnAllocator {
|
||||
friend bool operator<(NotAnAllocator, NotAnAllocator) { return false; }
|
||||
TEST_CONSTEXPR_CXX26 friend bool operator<(NotAnAllocator, NotAnAllocator) { return false; }
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
const int arr[] = {1, 2, 1, INT_MAX, 3};
|
||||
std::set s(std::begin(arr), std::end(arr));
|
||||
|
|
@ -212,5 +214,12 @@ int main(int, char**) {
|
|||
|
||||
AssociativeContainerDeductionGuidesSfinaeAway<std::set, std::set<int>>();
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// set();
|
||||
// constexpr set(); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
std::set<int> m;
|
||||
assert(m.empty());
|
||||
|
|
@ -51,5 +51,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
// <set>
|
||||
|
||||
// set()
|
||||
// constexpr set() // constexpr since C++26
|
||||
// noexcept(
|
||||
// is_nothrow_default_constructible<allocator_type>::value &&
|
||||
// is_nothrow_default_constructible<key_compare>::value &&
|
||||
|
|
@ -32,7 +32,7 @@ struct some_comp {
|
|||
bool operator()(const T&, const T&) const { return false; }
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
#if defined(_LIBCPP_VERSION)
|
||||
{
|
||||
typedef std::set<MoveOnly> C;
|
||||
|
|
@ -52,5 +52,12 @@ int main(int, char**) {
|
|||
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
// <set>
|
||||
|
||||
// ~set() // implied noexcept;
|
||||
// constexpr ~set() // implied noexcept; // constexpr since C++26
|
||||
|
||||
// UNSUPPORTED: c++03
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ struct some_comp {
|
|||
bool operator()(const T&, const T&) const { return false; }
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<MoveOnly> C;
|
||||
static_assert(std::is_nothrow_destructible<C>::value, "");
|
||||
|
|
@ -47,5 +47,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif // _LIBCPP_VERSION
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
|
||||
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=2147483647
|
||||
|
||||
// template<container-compatible-range<value_type> R>
|
||||
// set(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23
|
||||
|
|
@ -14,6 +15,7 @@
|
|||
// template<container-compatible-range<value_type> R>
|
||||
// set(from_range_t, R&& rg, const Allocator& a))
|
||||
// : set(from_range, std::forward<R>(rg), Compare(), a) { } // C++23
|
||||
// constexpr since C++26
|
||||
|
||||
#include <array>
|
||||
#include <set>
|
||||
|
|
@ -21,7 +23,7 @@
|
|||
#include "../../from_range_associative_containers.h"
|
||||
#include "test_macros.h"
|
||||
|
||||
void test_duplicates() {
|
||||
TEST_CONSTEXPR_CXX26 void test_duplicates() {
|
||||
using T = KeyValue;
|
||||
|
||||
std::array input = {T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}};
|
||||
|
|
@ -30,7 +32,7 @@ void test_duplicates() {
|
|||
assert(std::ranges::is_permutation(expected, c));
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
for_all_iterators_and_allocators<int>([]<class Iter, class Sent, class Alloc>() {
|
||||
test_associative_set<std::set, int, Iter, Sent, test_less<int>, Alloc>();
|
||||
});
|
||||
|
|
@ -42,5 +44,12 @@ int main(int, char**) {
|
|||
test_set_exception_safety_throwing_copy<std::set>();
|
||||
test_set_exception_safety_throwing_allocator<std::set, int>();
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// set(initializer_list<value_type> il, const key_compare& comp = key_compare());
|
||||
// constexpr set(initializer_list<value_type> il, const key_compare& comp = key_compare()); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<int> C;
|
||||
typedef C::value_type V;
|
||||
|
|
@ -50,5 +50,12 @@ int main(int, char**) {
|
|||
assert(*++i == V(6));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// set(initializer_list<value_type> il, const key_compare& comp = key_compare());
|
||||
// constexpr set(initializer_list<value_type> il, const key_compare& comp = key_compare()); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "../../../test_compare.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef test_less<int> Cmp;
|
||||
typedef std::set<int, Cmp> C;
|
||||
typedef C::value_type V;
|
||||
|
|
@ -37,5 +37,12 @@ int main(int, char**) {
|
|||
assert(*++i == V(6));
|
||||
assert(m.key_comp() == Cmp(10));
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
// class set
|
||||
|
||||
// set(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
|
||||
// set(initializer_list<value_type> il, const allocator_type& a);
|
||||
// constexpr set(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a); // constexpr since C++26
|
||||
// constexpr set(initializer_list<value_type> il, const allocator_type& a); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
#include "../../../test_compare.h"
|
||||
#include "test_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef test_less<int> Cmp;
|
||||
typedef test_allocator<int> A;
|
||||
|
|
@ -60,5 +60,12 @@ int main(int, char**) {
|
|||
assert(m.get_allocator() == A(4));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// class set
|
||||
|
||||
// template <class InputIterator>
|
||||
// set(InputIterator first, InputIterator last);
|
||||
// constexpr set(InputIterator first, InputIterator last); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
#include "test_iterators.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef int V;
|
||||
V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
|
||||
|
|
@ -46,5 +46,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@
|
|||
// class set
|
||||
|
||||
// template <class InputIterator>
|
||||
// set(InputIterator first, InputIterator last,
|
||||
// const value_compare& comp, const allocator_type& a);
|
||||
// constexpr set(InputIterator first, InputIterator last,
|
||||
// const value_compare& comp, const allocator_type& a); // constexpr since C++26
|
||||
//
|
||||
// template <class InputIterator>
|
||||
// set(InputIterator first, InputIterator last,
|
||||
// const allocator_type& a);
|
||||
// constexpr set(InputIterator first, InputIterator last,
|
||||
// const allocator_type& a); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
#include "../../../test_compare.h"
|
||||
#include "test_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef int V;
|
||||
V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
|
||||
|
|
@ -64,5 +64,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// class set
|
||||
|
||||
// template <class InputIterator>
|
||||
// set(InputIterator first, InputIterator last, const value_compare& comp);
|
||||
// constexpr set(InputIterator first, InputIterator last, const value_compare& comp); // constexpr since C++26
|
||||
|
||||
#include <cassert>
|
||||
#include <iterator>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
#include "test_iterators.h"
|
||||
#include "../../../test_compare.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef int V;
|
||||
V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
|
||||
typedef test_less<V> C;
|
||||
|
|
@ -34,5 +34,12 @@ int main(int, char**) {
|
|||
assert(*std::next(m.begin()) == 2);
|
||||
assert(*std::next(m.begin(), 2) == 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// set(set&& s);
|
||||
// constexpr set(set&& s); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
#include "test_allocator.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef int V;
|
||||
typedef test_less<int> C;
|
||||
|
|
@ -82,5 +82,12 @@ int main(int, char**) {
|
|||
assert(std::distance(mo.begin(), mo.end()) == 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// set(set&& s, const allocator_type& a);
|
||||
// constexpr set(set&& s, const allocator_type& a); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
#include "test_allocator.h"
|
||||
#include "Counter.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef MoveOnly V;
|
||||
typedef test_less<MoveOnly> C;
|
||||
|
|
@ -73,7 +73,7 @@ int main(int, char**) {
|
|||
assert(m3.key_comp() == C(5));
|
||||
LIBCPP_ASSERT(m1.empty());
|
||||
}
|
||||
{
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
typedef Counter<int> V;
|
||||
typedef std::less<V> C;
|
||||
typedef test_allocator<V> A;
|
||||
|
|
@ -111,5 +111,12 @@ int main(int, char**) {
|
|||
assert(Counter_base::gConstructed == 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// set& operator=(set&& s);
|
||||
// constexpr set& operator=(set&& s); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
#include "test_allocator.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef MoveOnly V;
|
||||
typedef test_less<MoveOnly> C;
|
||||
|
|
@ -93,5 +93,12 @@ int main(int, char**) {
|
|||
assert(m1.empty());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
// <set>
|
||||
|
||||
// set(set&&)
|
||||
// constexpr set(set&&)
|
||||
// noexcept(is_nothrow_move_constructible<allocator_type>::value &&
|
||||
// is_nothrow_move_constructible<key_compare>::value);
|
||||
// is_nothrow_move_constructible<key_compare>::value); // constexpr since C++26
|
||||
|
||||
// This tests a conforming extension
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ struct some_comp {
|
|||
bool operator()(const T&, const T&) const { return false; }
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
#if defined(_LIBCPP_VERSION)
|
||||
{
|
||||
typedef std::set<MoveOnly> C;
|
||||
|
|
@ -50,5 +50,12 @@ int main(int, char**) {
|
|||
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
// template <class T, class Compare, class Allocator, class Predicate>
|
||||
// typename set<T, Compare, Allocator>::size_type
|
||||
// erase_if(set<T, Compare, Allocator>& c, Predicate pred);
|
||||
// constexpr erase_if(set<T, Compare, Allocator>& c, Predicate pred); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
|
||||
|
|
@ -20,14 +20,14 @@
|
|||
#include "min_allocator.h"
|
||||
|
||||
template <class S, class Pred>
|
||||
void test0(S s, Pred p, S expected, std::size_t expected_erased_count) {
|
||||
TEST_CONSTEXPR_CXX26 void test0(S s, Pred p, S expected, std::size_t expected_erased_count) {
|
||||
ASSERT_SAME_TYPE(typename S::size_type, decltype(std::erase_if(s, p)));
|
||||
assert(expected_erased_count == std::erase_if(s, p));
|
||||
assert(s == expected);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
void test() {
|
||||
TEST_CONSTEXPR_CXX26 void test() {
|
||||
auto is1 = [](auto v) { return v == 1; };
|
||||
auto is2 = [](auto v) { return v == 2; };
|
||||
auto is3 = [](auto v) { return v == 3; };
|
||||
|
|
@ -53,7 +53,7 @@ void test() {
|
|||
test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
|
||||
}
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
test<std::set<int>>();
|
||||
test<std::set<int, std::less<int>, min_allocator<int>>>();
|
||||
test<std::set<int, std::less<int>, test_allocator<int>>>();
|
||||
|
|
@ -61,5 +61,12 @@ int main(int, char**) {
|
|||
test<std::set<long>>();
|
||||
test<std::set<double>>();
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,16 +12,22 @@
|
|||
// class set
|
||||
|
||||
// template<class Key, class Compare, class Allocator>
|
||||
// synth-three-way-result<Key> operator<=>(const set<Key, Compare, Allocator>& x,
|
||||
// const set<Key, Compare, Allocator>& y);
|
||||
// constexpr synth-three-way-result<Key> operator<=>(const set<Key, Compare, Allocator>& x,
|
||||
// const set<Key, Compare, Allocator>& y); // constexpr since C++26
|
||||
|
||||
#include <cassert>
|
||||
#include <set>
|
||||
|
||||
#include "test_container_comparisons.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
assert((test_ordered_set_container_spaceship<std::set>()));
|
||||
// `std::set` is not constexpr, so no `static_assert` test here.
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,28 +9,28 @@
|
|||
// <set>
|
||||
|
||||
// template<class Key, class Compare, class Alloc>
|
||||
// bool operator==(const std::set<Key, Compare, Alloc>& lhs,
|
||||
// const std::set<Key, Compare, Alloc>& rhs);
|
||||
// constexpr bool operator==(const std::set<Key, Compare, Alloc>& lhs,
|
||||
// const std::set<Key, Compare, Alloc>& rhs); // constexpr since C++26
|
||||
//
|
||||
// template<class Key, class Compare, class Alloc>
|
||||
// bool operator!=(const std::set<Key, Compare, Alloc>& lhs,
|
||||
// const std::set<Key, Compare, Alloc>& rhs);
|
||||
// constexpr bool operator!=(const std::set<Key, Compare, Alloc>& lhs,
|
||||
// const std::set<Key, Compare, Alloc>& rhs); // constexpr since C++26
|
||||
//
|
||||
// template<class Key, class Compare, class Alloc>
|
||||
// bool operator<(const std::set<Key, Compare, Alloc>& lhs,
|
||||
// const std::set<Key, Compare, Alloc>& rhs);
|
||||
// constexpr bool operator<(const std::set<Key, Compare, Alloc>& lhs,
|
||||
// const std::set<Key, Compare, Alloc>& rhs); // constexpr since C++26
|
||||
//
|
||||
// template<class Key, class Compare, class Alloc>
|
||||
// bool operator>(const std::set<Key, Compare, Alloc>& lhs,
|
||||
// const std::set<Key, Compare, Alloc>& rhs);
|
||||
// constexpr bool operator>(const std::set<Key, Compare, Alloc>& lhs,
|
||||
// const std::set<Key, Compare, Alloc>& rhs); // constexpr since C++26
|
||||
//
|
||||
// template<class Key, class Compare, class Alloc>
|
||||
// bool operator<=(const std::set<Key, Compare, Alloc>& lhs,
|
||||
// const std::set<Key, Compare, Alloc>& rhs);
|
||||
// constexpr bool operator<=(const std::set<Key, Compare, Alloc>& lhs,
|
||||
// const std::set<Key, Compare, Alloc>& rhs); // constexpr since C++26
|
||||
//
|
||||
// template<class Key, class Compare, class Alloc>
|
||||
// bool operator>=(const std::set<Key, Compare, Alloc>& lhs,
|
||||
// const std::set<Key, Compare, Alloc>& rhs);
|
||||
// constexpr bool operator>=(const std::set<Key, Compare, Alloc>& lhs,
|
||||
// const std::set<Key, Compare, Alloc>& rhs); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "test_comparisons.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
std::set<int> s1, s2;
|
||||
s1.insert(1);
|
||||
|
|
@ -61,5 +61,12 @@ int main(int, char**) {
|
|||
const std::set<int>&cs1 = s1, cs2 = s2;
|
||||
assert(testComparisons(cs1, cs2, false, true));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,15 @@
|
|||
|
||||
// <set>
|
||||
|
||||
// key_compare key_comp() const;
|
||||
// value_compare value_comp() const;
|
||||
// constexpr key_compare key_comp() const; // constexpr since C++26
|
||||
// constexpr value_compare value_comp() const; // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
||||
int main(int, char**) {
|
||||
#include "test_macros.h"
|
||||
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef std::set<int> set_type;
|
||||
|
||||
set_type s;
|
||||
|
|
@ -29,5 +31,12 @@ int main(int, char**) {
|
|||
assert(cs.value_comp()(*p1.first, *p2.first));
|
||||
assert(!cs.value_comp()(*p2.first, *p1.first));
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// void swap(set& m);
|
||||
// constexpr void swap(set& m); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef int V;
|
||||
typedef std::set<int> M;
|
||||
|
|
@ -110,5 +110,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// void swap(set& m);
|
||||
// constexpr void swap(set& m); // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "test_allocator.h"
|
||||
#include "../../../test_compare.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
typedef int V;
|
||||
{
|
||||
typedef std::set<int> M;
|
||||
|
|
@ -100,5 +100,12 @@ int main(int, char**) {
|
|||
assert(m2.get_allocator() == A(1));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// <set>
|
||||
|
||||
// void swap(set& c)
|
||||
// constexpr void swap(set& c) // constexpr since C++26
|
||||
// noexcept(!allocator_type::propagate_on_container_swap::value ||
|
||||
// __is_nothrow_swappable<allocator_type>::value);
|
||||
//
|
||||
|
|
@ -86,7 +86,7 @@ struct some_alloc3 {
|
|||
typedef std::false_type is_always_equal;
|
||||
};
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<MoveOnly> C;
|
||||
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
|
||||
|
|
@ -131,5 +131,12 @@ int main(int, char**) {
|
|||
# endif // _LIBCPP_VERSION
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// class set
|
||||
|
||||
// size_type size() const;
|
||||
// constexpr size_type size() const; // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<int> M;
|
||||
M m;
|
||||
|
|
@ -56,5 +56,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#include "test_macros.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef std::set<int> C;
|
||||
static_assert((std::is_same<C::key_type, int>::value), "");
|
||||
|
|
@ -67,5 +67,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
// class set
|
||||
|
||||
// iterator upper_bound(const key_type& k);
|
||||
// const_iterator upper_bound(const key_type& k) const;
|
||||
// constexpr iterator upper_bound(const key_type& k); // constexpr since C++26
|
||||
// constexpr const_iterator upper_bound(const key_type& k) const; // constexpr since C++26
|
||||
|
||||
#include <set>
|
||||
#include <cassert>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
#include "min_allocator.h"
|
||||
#include "private_constructor.h"
|
||||
|
||||
int main(int, char**) {
|
||||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
{
|
||||
typedef int V;
|
||||
typedef std::set<int> M;
|
||||
|
|
@ -283,5 +283,12 @@ int main(int, char**) {
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
int main(int, char**) {
|
||||
test();
|
||||
#if TEST_STD_VER >= 26
|
||||
static_assert(test());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,10 +150,10 @@ TEST_CONSTEXPR_CXX26 bool test_insert_return_type() {
|
|||
TEST_CONSTEXPR_CXX26 bool test() {
|
||||
test_node_handle_operations<std::map<int, int>>();
|
||||
test_node_handle_operations_multi<std::multimap<int, int>>();
|
||||
test_node_handle_operations<std::set<int>>();
|
||||
|
||||
// FIXME: update when other containers are made constexpr
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
test_node_handle_operations<std::set<int>>();
|
||||
test_node_handle_operations_multi<std::multiset<int>>();
|
||||
test_node_handle_operations<std::unordered_map<int, int>>();
|
||||
test_node_handle_operations_multi<std::unordered_multimap<int, int>>();
|
||||
|
|
@ -162,10 +162,10 @@ TEST_CONSTEXPR_CXX26 bool test() {
|
|||
}
|
||||
|
||||
test_insert_return_type<std::map<int, int>>();
|
||||
test_insert_return_type<std::set<int>>();
|
||||
|
||||
// FIXME: update when other containers are made constexpr
|
||||
if (!TEST_IS_CONSTANT_EVALUATED) {
|
||||
test_insert_return_type<std::set<int>>();
|
||||
test_insert_return_type<std::unordered_map<int, int>>();
|
||||
test_insert_return_type<std::unordered_set<int>>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ struct KeyValue {
|
|||
int key; // Only the key is considered for equality comparison.
|
||||
char value; // Allows distinguishing equivalent instances.
|
||||
|
||||
bool operator<(const KeyValue& other) const { return key < other.key; }
|
||||
bool operator==(const KeyValue& other) const { return key == other.key; }
|
||||
TEST_CONSTEXPR_CXX26 bool operator<(const KeyValue& other) const { return key < other.key; }
|
||||
TEST_CONSTEXPR_CXX26 bool operator==(const KeyValue& other) const { return key == other.key; }
|
||||
};
|
||||
|
||||
template <>
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ TEST_CONSTEXPR_CXX26 void test_map_set_insert_range(bool allow_duplicates = fals
|
|||
// Move-only types.
|
||||
|
||||
template <template <class...> class Container>
|
||||
void test_set_insert_range_move_only() {
|
||||
TEST_CONSTEXPR_CXX26 void test_set_insert_range_move_only() {
|
||||
MoveOnly input[5];
|
||||
std::ranges::subrange in(std::move_iterator{input}, std::move_iterator{input + 5});
|
||||
|
||||
|
|
@ -272,8 +272,8 @@ TEST_CONSTEXPR_CXX26 bool test_map_insert_range_move_only() {
|
|||
// Exception safety.
|
||||
|
||||
template <template <class...> class Container>
|
||||
void test_set_insert_range_exception_safety_throwing_copy() {
|
||||
#if !defined(TEST_HAS_NO_EXCEPTIONS)
|
||||
TEST_CONSTEXPR_CXX26 void test_set_insert_range_exception_safety_throwing_copy() {
|
||||
#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(TEST_IS_CONSTANT_EVALUATED)
|
||||
using T = ThrowingCopy<3>;
|
||||
T::reset();
|
||||
T in[5] = {{1}, {2}, {3}, {4}, {5}};
|
||||
|
|
@ -314,8 +314,8 @@ TEST_CONSTEXPR_CXX26 void test_map_insert_range_exception_safety_throwing_copy()
|
|||
}
|
||||
|
||||
template <template <class...> class Container, class T>
|
||||
void test_assoc_set_insert_range_exception_safety_throwing_allocator() {
|
||||
#if !defined(TEST_HAS_NO_EXCEPTIONS)
|
||||
TEST_CONSTEXPR_CXX26 void test_assoc_set_insert_range_exception_safety_throwing_allocator() {
|
||||
#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(TEST_IS_CONSTANT_EVALUATED)
|
||||
T in[] = {1, 2};
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "container_test_types.h"
|
||||
|
||||
template <class Container>
|
||||
void testSetInsert() {
|
||||
TEST_CONSTEXPR_CXX26 void testSetInsert() {
|
||||
typedef typename Container::value_type ValueTp;
|
||||
ConstructController* cc = getConstructController();
|
||||
cc->reset();
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@
|
|||
# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_set
|
||||
# error "__cpp_lib_constexpr_set 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
|
||||
|
|
@ -66,6 +70,10 @@
|
|||
# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_set
|
||||
# error "__cpp_lib_constexpr_set 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
|
||||
|
|
@ -106,6 +114,10 @@
|
|||
# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_set
|
||||
# error "__cpp_lib_constexpr_set 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
|
||||
|
|
@ -152,6 +164,10 @@
|
|||
# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_set
|
||||
# error "__cpp_lib_constexpr_set 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
|
||||
|
|
@ -210,6 +226,10 @@
|
|||
# error "__cpp_lib_associative_heterogeneous_insertion should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_set
|
||||
# error "__cpp_lib_constexpr_set 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
|
||||
|
|
@ -280,6 +300,13 @@
|
|||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef __cpp_lib_constexpr_set
|
||||
# error "__cpp_lib_constexpr_set should be defined in c++26"
|
||||
# endif
|
||||
# if __cpp_lib_constexpr_set != 202502L
|
||||
# error "__cpp_lib_constexpr_set 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
|
||||
|
|
|
|||
|
|
@ -252,6 +252,10 @@
|
|||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_set
|
||||
# error "__cpp_lib_constexpr_set should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_string
|
||||
# error "__cpp_lib_constexpr_string should not be defined before c++20"
|
||||
# endif
|
||||
|
|
@ -1188,6 +1192,10 @@
|
|||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_set
|
||||
# error "__cpp_lib_constexpr_set should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_string
|
||||
# error "__cpp_lib_constexpr_string should not be defined before c++20"
|
||||
# endif
|
||||
|
|
@ -2226,6 +2234,10 @@
|
|||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_set
|
||||
# error "__cpp_lib_constexpr_set should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_string
|
||||
# error "__cpp_lib_constexpr_string should not be defined before c++20"
|
||||
# endif
|
||||
|
|
@ -3510,6 +3522,10 @@
|
|||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_set
|
||||
# error "__cpp_lib_constexpr_set should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifndef __cpp_lib_constexpr_string
|
||||
# error "__cpp_lib_constexpr_string should be defined in c++20"
|
||||
# endif
|
||||
|
|
@ -5004,6 +5020,10 @@
|
|||
# error "__cpp_lib_constexpr_queue should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifdef __cpp_lib_constexpr_set
|
||||
# error "__cpp_lib_constexpr_set should not be defined before c++26"
|
||||
# endif
|
||||
|
||||
# ifndef __cpp_lib_constexpr_string
|
||||
# error "__cpp_lib_constexpr_string should be defined in c++23"
|
||||
# endif
|
||||
|
|
@ -6744,6 +6764,13 @@
|
|||
# error "__cpp_lib_constexpr_queue should have the value 202502L in c++26"
|
||||
# endif
|
||||
|
||||
# ifndef __cpp_lib_constexpr_set
|
||||
# error "__cpp_lib_constexpr_set should be defined in c++26"
|
||||
# endif
|
||||
# if __cpp_lib_constexpr_set != 202502L
|
||||
# error "__cpp_lib_constexpr_set should have the value 202502L in c++26"
|
||||
# endif
|
||||
|
||||
# ifndef __cpp_lib_constexpr_string
|
||||
# error "__cpp_lib_constexpr_string should be defined in c++26"
|
||||
# endif
|
||||
|
|
|
|||
|
|
@ -432,6 +432,11 @@ feature_test_macros = [
|
|||
"values": {"c++26": 202502},
|
||||
"headers": ["queue"],
|
||||
},
|
||||
{
|
||||
"name": "__cpp_lib_constexpr_set",
|
||||
"values": {"c++26": 202502},
|
||||
"headers": ["set"],
|
||||
},
|
||||
{
|
||||
"name": "__cpp_lib_constexpr_string",
|
||||
"values": {"c++20": 201907},
|
||||
|
|
|
|||
Loading…
Reference in a new issue