diff options
Diffstat (limited to 'libcxx/include/set')
-rw-r--r-- | libcxx/include/set | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/libcxx/include/set b/libcxx/include/set index 342a529..b444e83 100644 --- a/libcxx/include/set +++ b/libcxx/include/set @@ -522,7 +522,6 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20 # include <__config> # include <__functional/is_transparent.h> # include <__functional/operations.h> -# include <__fwd/set.h> # include <__iterator/erase_if_container.h> # include <__iterator/iterator_traits.h> # include <__iterator/ranges_iterator_traits.h> @@ -531,6 +530,7 @@ erase_if(multiset<Key, Compare, Allocator>& c, Predicate pred); // C++20 # include <__memory/allocator_traits.h> # include <__memory_resource/polymorphic_allocator.h> # include <__node_handle> +# include <__ranges/access.h> # include <__ranges/concepts.h> # include <__ranges/container_compatible_range.h> # include <__ranges/from_range.h> @@ -570,7 +570,10 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -template <class _Key, class _Compare, class _Allocator> +template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> > +class multiset; + +template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<_Key> > class set { public: // types: @@ -665,7 +668,7 @@ public: _LIBCPP_HIDE_FROM_ABI set& operator=(const set& __s) = default; # ifndef _LIBCPP_CXX03_LANG - _LIBCPP_HIDE_FROM_ABI set(set&& __s) noexcept(is_nothrow_move_constructible<__base>::value) = default; + _LIBCPP_HIDE_FROM_ABI set(set&& __s) = default; # endif // _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI explicit set(const allocator_type& __a) : __tree_(__a) {} @@ -697,10 +700,7 @@ public: return *this; } - _LIBCPP_HIDE_FROM_ABI set& operator=(set&& __s) noexcept(is_nothrow_move_assignable<__base>::value) { - __tree_ = std::move(__s.__tree_); - return *this; - } + _LIBCPP_HIDE_FROM_ABI set& operator=(set&& __s) = default; # endif // _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI ~set() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); } @@ -732,13 +732,13 @@ public: } template <class... _Args> _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) { - return __tree_.__emplace_hint_unique(__p, std::forward<_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) { - return __tree_.__emplace_hint_unique(__p, __v); + return __tree_.__emplace_hint_unique(__p, __v).first; } template <class _InputIterator> @@ -763,7 +763,7 @@ public: } _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) { - return __tree_.__emplace_hint_unique(__p, std::move(__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()); } @@ -951,7 +951,7 @@ set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) : __t if (__a != __s.get_allocator()) { const_iterator __e = cend(); while (!__s.empty()) - insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_)); + insert(__e, std::move(__s.__tree_.remove(__s.begin())->__get_value())); } } @@ -1124,7 +1124,7 @@ public: _LIBCPP_HIDE_FROM_ABI multiset& operator=(const multiset& __s) = default; # ifndef _LIBCPP_CXX03_LANG - _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s) noexcept(is_nothrow_move_constructible<__base>::value) = default; + _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s) = default; _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s, const allocator_type& __a); # endif // _LIBCPP_CXX03_LANG @@ -1156,10 +1156,7 @@ public: return *this; } - _LIBCPP_HIDE_FROM_ABI multiset& operator=(multiset&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) { - __tree_ = std::move(__s.__tree_); - return *this; - } + _LIBCPP_HIDE_FROM_ABI multiset& operator=(multiset&& __s) = default; # endif // _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI ~multiset() { @@ -1203,18 +1200,14 @@ public: } template <class _InputIterator> - _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) { - for (const_iterator __e = cend(); __f != __l; ++__f) - __tree_.__emplace_hint_multi(__e, *__f); + _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) { + __tree_.__insert_range_multi(__first, __last); } # if _LIBCPP_STD_VER >= 23 template <_ContainerCompatibleRange<value_type> _Range> _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) { - const_iterator __end = cend(); - for (auto&& __element : __range) { - __tree_.__emplace_hint_multi(__end, std::forward<decltype(__element)>(__element)); - } + __tree_.__insert_range_multi(ranges::begin(__range), ranges::end(__range)); } # endif @@ -1414,7 +1407,7 @@ multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_t if (__a != __s.get_allocator()) { const_iterator __e = cend(); while (!__s.empty()) - insert(__e, std::move(__s.__tree_.remove(__s.begin())->__value_)); + insert(__e, std::move(__s.__tree_.remove(__s.begin())->__get_value())); } } |