11#ifndef INCLUDED_BSLSTL_SET_CPP03
12#define INCLUDED_BSLSTL_SET_CPP03
63#ifdef COMPILING_BSLSTL_SET_H
85 class COMPARATOR = std::less<KEY>,
86 class ALLOCATOR = allocator<KEY> >
93 typedef const KEY ValueType;
97 typedef BloombergLP::bslstl::SetComparator<KEY, COMPARATOR> Comparator;
101 typedef BloombergLP::bslstl::TreeNode<KEY> Node;
105 typedef BloombergLP::bslstl::TreeNodePool<KEY, ALLOCATOR> NodeFactory;
113 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
124 class DataWrapper :
public Comparator {
131 DataWrapper(
const DataWrapper&);
132 DataWrapper& operator=(
const DataWrapper&);
140 explicit DataWrapper(
const COMPARATOR& comparator,
141 const ALLOCATOR& basicAllocator);
149 BloombergLP::bslmf::MovableRef<DataWrapper> original);
155 NodeFactory& nodeFactory();
161 const NodeFactory& nodeFactory()
const;
165 DataWrapper d_compAndAlloc;
169 BloombergLP::bslalg::RbTreeAnchor d_tree;
187 typedef BloombergLP::bslstl::TreeIterator<
const value_type,
190 typedef BloombergLP::bslstl::TreeIterator<
const value_type,
201 NodeFactory& nodeFactory();
205 Comparator& comparator();
212 void quickSwapExchangeAllocators(
set& other);
221 void quickSwapRetainAllocators(
set& other);
227 template <
class INPUT_ITERATOR,
class SENTINEL>
228 void constructFromRange(INPUT_ITERATOR first, SENTINEL last);
230#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
231 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
241 template <
class INPUT_ITERATOR,
class SENTINEL>
242 void constructFromRange(INPUT_ITERATOR first,
248 template <
class INPUT_ITERATOR,
class SENTINEL>
249 void insertFromRange(INPUT_ITERATOR first,
252#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
253 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
261 template <
class INPUT_ITERATOR,
class SENTINEL>
262 void insertFromRange(INPUT_ITERATOR first,
271 const NodeFactory& nodeFactory()
const;
275 const Comparator& comparator()
const;
293 explicit set(
const COMPARATOR& comparator,
294 const ALLOCATOR& basicAllocator = ALLOCATOR())
295 : d_compAndAlloc(comparator, basicAllocator)
312 explicit set(
const ALLOCATOR& basicAllocator);
330 set(BloombergLP::bslmf::MovableRef<set> original);
342 const typename type_identity<ALLOCATOR>::type& basicAllocator);
357 set(BloombergLP::bslmf::MovableRef<set> original,
358 const typename type_identity<ALLOCATOR>::type& basicAllocator);
388 template <
class INPUT_ITERATOR>
389 set(INPUT_ITERATOR first,
391 const COMPARATOR& comparator = COMPARATOR(),
392 const ALLOCATOR& basicAllocator = ALLOCATOR());
393 template <
class INPUT_ITERATOR>
394 set(INPUT_ITERATOR first,
396 const ALLOCATOR& basicAllocator);
417 template <
class RANGE>
421 const COMPARATOR& comparator = COMPARATOR(),
422 const ALLOCATOR& basicAllocator = ALLOCATOR())
423 : d_compAndAlloc(comparator, basicAllocator)
428#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
429 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
430 if constexpr (ranges::sized_range<RANGE>) {
431 constructFromRange(bsl::ranges::begin(range),
432 bsl::ranges::end (range),
433 bsl::ranges::size (range));
437 constructFromRange(bsl::ranges::begin(range),
438 bsl::ranges::end (range));
442 template <
class RANGE>
446 const ALLOCATOR& basicAllocator)
447 : d_compAndAlloc(COMPARATOR(), basicAllocator)
455 nodeFactory().allocator());
456 quickSwapRetainAllocators(other);
459#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
479 set(std::initializer_list<KEY> values,
480 const COMPARATOR& comparator = COMPARATOR(),
481 const ALLOCATOR& basicAllocator = ALLOCATOR());
482 set(std::initializer_list<KEY> values,
483 const ALLOCATOR& basicAllocator);
516 AllocatorTraits::is_always_equal::value
517 && std::is_nothrow_move_assignable<COMPARATOR>::value);
519#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
578 template <class LOOKUP_KEY>
580 BloombergLP::
bslmf::IsTransparentPredicate<COMPARATOR,
585 typedef pair<iterator, bool> Result;
587 int comparisonResult;
588 BloombergLP::bslalg::RbTreeNode *insertLocation =
589 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
594 if (!comparisonResult) {
595 return Result(
iterator(insertLocation),
false);
597 BloombergLP::bslalg::RbTreeNode *node =
598 nodeFactory().emplaceIntoNewNode(
600 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
602 comparisonResult < 0,
604 return Result(
iterator(node),
true);
638 BloombergLP::bslmf::MovableRef<value_type> value);
643 template <
class LOOKUP_KEY>
645 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
655 BloombergLP::bslalg::RbTreeNode *hintNode =
656 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
658 int comparisonResult;
659 BloombergLP::bslalg::RbTreeNode *insertLocation =
660 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
666 if (!comparisonResult) {
670 BloombergLP::bslalg::RbTreeNode *node =
671 nodeFactory().emplaceIntoNewNode(
674 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
676 comparisonResult < 0,
695 template <
class INPUT_ITERATOR>
696 void insert(INPUT_ITERATOR first, INPUT_ITERATOR last);
698#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
704 void insert(std::initializer_list<KEY> values);
716 template <
class RANGE>
722#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
723 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
724 if constexpr (ranges::sized_range<RANGE>) {
725 insertFromRange(bsl::ranges::begin(range),
726 bsl::ranges::end (range),
727 bsl::ranges::size (range));
731 insertFromRange(bsl::ranges::begin(range),
732 bsl::ranges::end (range));
736#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
739#ifndef BSLSTL_SET_VARIADIC_LIMIT
740#define BSLSTL_SET_VARIADIC_LIMIT 10
742#ifndef BSLSTL_SET_VARIADIC_LIMIT_C
743#define BSLSTL_SET_VARIADIC_LIMIT_C BSLSTL_SET_VARIADIC_LIMIT
746#if BSLSTL_SET_VARIADIC_LIMIT_C >= 0
751#if BSLSTL_SET_VARIADIC_LIMIT_C >= 1
752 template <
class Args_01>
757#if BSLSTL_SET_VARIADIC_LIMIT_C >= 2
758 template <
class Args_01,
765#if BSLSTL_SET_VARIADIC_LIMIT_C >= 3
766 template <
class Args_01,
775#if BSLSTL_SET_VARIADIC_LIMIT_C >= 4
776 template <
class Args_01,
787#if BSLSTL_SET_VARIADIC_LIMIT_C >= 5
788 template <
class Args_01,
801#if BSLSTL_SET_VARIADIC_LIMIT_C >= 6
802 template <
class Args_01,
817#if BSLSTL_SET_VARIADIC_LIMIT_C >= 7
818 template <
class Args_01,
835#if BSLSTL_SET_VARIADIC_LIMIT_C >= 8
836 template <
class Args_01,
855#if BSLSTL_SET_VARIADIC_LIMIT_C >= 9
856 template <
class Args_01,
877#if BSLSTL_SET_VARIADIC_LIMIT_C >= 10
878 template <
class Args_01,
902#if BSLSTL_SET_VARIADIC_LIMIT_C >= 0
906#if BSLSTL_SET_VARIADIC_LIMIT_C >= 1
907 template <
class Args_01>
912#if BSLSTL_SET_VARIADIC_LIMIT_C >= 2
913 template <
class Args_01,
920#if BSLSTL_SET_VARIADIC_LIMIT_C >= 3
921 template <
class Args_01,
930#if BSLSTL_SET_VARIADIC_LIMIT_C >= 4
931 template <
class Args_01,
942#if BSLSTL_SET_VARIADIC_LIMIT_C >= 5
943 template <
class Args_01,
956#if BSLSTL_SET_VARIADIC_LIMIT_C >= 6
957 template <
class Args_01,
972#if BSLSTL_SET_VARIADIC_LIMIT_C >= 7
973 template <
class Args_01,
990#if BSLSTL_SET_VARIADIC_LIMIT_C >= 8
991 template <
class Args_01,
1010#if BSLSTL_SET_VARIADIC_LIMIT_C >= 9
1011 template <
class Args_01,
1032#if BSLSTL_SET_VARIADIC_LIMIT_C >= 10
1033 template <
class Args_01,
1060 template <
class... Args>
1064 template <
class... Args>
1089 template <
class t_KEY>
1091 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1138 AllocatorTraits::is_always_equal::value
1139 && bsl::is_nothrow_swappable<COMPARATOR>::value);
1158 return iterator(BloombergLP::bslalg::RbTreeUtil::find(
1159 d_tree, this->comparator(), key));
1168 template <
class LOOKUP_KEY>
1170 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1173 find(
const LOOKUP_KEY& key)
1175 return iterator(BloombergLP::bslalg::RbTreeUtil::find(
1176 d_tree, this->comparator(), key));
1192 return iterator(BloombergLP::bslalg::RbTreeUtil::lowerBound(
1193 d_tree, this->comparator(), key));
1207 template <
class LOOKUP_KEY>
1209 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1214 return iterator(BloombergLP::bslalg::RbTreeUtil::lowerBound(
1215 d_tree, this->comparator(), key));
1230 return iterator(BloombergLP::bslalg::RbTreeUtil::upperBound(
1231 d_tree, this->comparator(), key));
1244 template <
class LOOKUP_KEY>
1246 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1251 return iterator(BloombergLP::bslalg::RbTreeUtil::upperBound(
1252 d_tree, this->comparator(), key));
1272 if (endIt !=
end() && !comparator()(key, *endIt.node())) {
1275 return pair<iterator, iterator>(startIt, endIt);
1294 template <
class LOOKUP_KEY>
1296 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1298 pair<iterator, iterator> >::type
1303 if (endIt !=
end() && !comparator()(key, *endIt.node())) {
1311 if (endIt !=
end() && !comparator()(key, *endIt.node())) {
1315 return pair<iterator, iterator>(startIt, endIt);
1374 template <class LOOKUP_KEY>
1375 typename
bsl::enable_if<
1376 BloombergLP::
bslmf::IsTransparentPredicate<COMPARATOR,
1379 contains(const LOOKUP_KEY& key)
const
1425 d_tree, this->comparator(), key));
1434 template <
class LOOKUP_KEY>
1436 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1439 find(
const LOOKUP_KEY& key)
const
1442 d_tree, this->comparator(), key));
1453 return (
find(key) !=
end()) ? 1 : 0;
1465 template <
class LOOKUP_KEY>
1467 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1470 count(
const LOOKUP_KEY& key)
const
1475 while (it !=
end() && !comparator()(key, *it.node())) {
1495 return const_iterator(BloombergLP::bslalg::RbTreeUtil::lowerBound(
1496 d_tree, this->comparator(), key));
1510 template <
class LOOKUP_KEY>
1512 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1517 return const_iterator(BloombergLP::bslalg::RbTreeUtil::lowerBound(
1518 d_tree, this->comparator(), key));
1534 return const_iterator(BloombergLP::bslalg::RbTreeUtil::upperBound(
1535 d_tree, this->comparator(), key));
1549 template <
class LOOKUP_KEY>
1551 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1556 return const_iterator(BloombergLP::bslalg::RbTreeUtil::upperBound(
1557 d_tree, this->comparator(), key));
1577 if (endIt !=
end() && !comparator()(key, *endIt.node())) {
1580 return pair<const_iterator, const_iterator>(startIt, endIt);
1599 template <
class LOOKUP_KEY>
1601 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1603 pair<const_iterator, const_iterator> >::type
1608 if (endIt !=
end() && !comparator()(key, *endIt.node())) {
1616 if (endIt !=
end() && !comparator()(key, *endIt.node())) {
1620 return pair<const_iterator, const_iterator>(startIt, endIt);
1626#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1636 class INPUT_ITERATOR,
1637 class KEY =
typename bsl::iterator_traits<INPUT_ITERATOR>::value_type,
1638 class COMPARATOR = std::less<KEY>,
1640 class = bsl::enable_if_t<!bsl::IsStdAllocator_v<COMPARATOR>>,
1641 class = bsl::enable_if_t<
bsl::IsStdAllocator_v<ALLOCATOR>>
1645 COMPARATOR = COMPARATOR(),
1646 ALLOCATOR = ALLOCATOR())
1647-> set<KEY, COMPARATOR, ALLOCATOR>;
1655 class INPUT_ITERATOR,
1659 typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1660 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1661 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1663set(INPUT_ITERATOR, INPUT_ITERATOR, COMPARATOR, ALLOC *)
1664-> set<KEY, COMPARATOR>;
1672 class INPUT_ITERATOR,
1675 typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1676 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1678set(INPUT_ITERATOR, INPUT_ITERATOR, ALLOCATOR)
1679-> set<KEY, std::less<KEY>, ALLOCATOR>;
1686 class INPUT_ITERATOR,
1689 typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1690 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1691 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1693set(INPUT_ITERATOR, INPUT_ITERATOR, ALLOC *)
1702 class COMPARATOR = std::less<KEY>,
1703 class ALLOCATOR = bsl::allocator<KEY>,
1704 class = bsl::enable_if_t<!bsl::IsStdAllocator_v<COMPARATOR>>,
1705 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1707set(std::initializer_list<KEY>,
1708 COMPARATOR = COMPARATOR(),
1709 ALLOCATOR = ALLOCATOR())
1710-> set<KEY, COMPARATOR, ALLOCATOR>;
1721 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1722 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1724set(std::initializer_list<KEY>, COMPARATOR, ALLOC *)
1725-> set<KEY, COMPARATOR>;
1734 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1736set(std::initializer_list<KEY>, ALLOCATOR)
1737-> set<KEY, std::less<KEY>, ALLOCATOR>;
1746 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1747 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1749set(std::initializer_list<KEY>, ALLOC *)
1763template <class KEY, class COMPARATOR, class ALLOCATOR>
1764bool operator==(const set<KEY, COMPARATOR, ALLOCATOR>& lhs,
1765 const set<KEY, COMPARATOR, ALLOCATOR>& rhs);
1767#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
1775template <class KEY, class COMPARATOR, class ALLOCATOR>
1776bool operator!=(const set<KEY, COMPARATOR, ALLOCATOR>& lhs,
1777 const set<KEY, COMPARATOR, ALLOCATOR>& rhs);
1780#ifdef BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
1785template <class KEY, class COMPARATOR, class ALLOCATOR>
1786BloombergLP::bslalg::SynthThreeWayUtil::Result<KEY>
1787operator<=>(const set<KEY, COMPARATOR, ALLOCATOR>& lhs,
1788 const set<KEY, COMPARATOR, ALLOCATOR>& rhs);
1803template <class KEY, class COMPARATOR, class ALLOCATOR>
1804bool operator< (const set<KEY, COMPARATOR, ALLOCATOR>& lhs,
1805 const set<KEY, COMPARATOR, ALLOCATOR>& rhs);
1815template <class KEY, class COMPARATOR, class ALLOCATOR>
1816bool operator> (const set<KEY, COMPARATOR, ALLOCATOR>& lhs,
1817 const set<KEY, COMPARATOR, ALLOCATOR>& rhs);
1827template <class KEY, class COMPARATOR, class ALLOCATOR>
1828bool operator<=(const set<KEY, COMPARATOR, ALLOCATOR>& lhs,
1829 const set<KEY, COMPARATOR, ALLOCATOR>& rhs);
1839template <class KEY, class COMPARATOR, class ALLOCATOR>
1840bool operator>=(const set<KEY, COMPARATOR, ALLOCATOR>& lhs,
1841 const set<KEY, COMPARATOR, ALLOCATOR>& rhs);
1849template <class KEY, class COMPARATOR, class ALLOCATOR, class PREDICATE>
1850typename set<KEY, COMPARATOR, ALLOCATOR>::size_type
1851erase_if(set<KEY, COMPARATOR, ALLOCATOR>& s, PREDICATE predicate);
1871template <class KEY, class COMPARATOR, class ALLOCATOR>
1872void
swap(set<KEY, COMPARATOR, ALLOCATOR>& a,
1873 set<KEY, COMPARATOR, ALLOCATOR>& b)
1875 BSLS_KEYWORD_NOEXCEPT_OPERATOR(a.swap(b)));
1886template <class KEY, class COMPARATOR, class ALLOCATOR>
1888set<KEY, COMPARATOR, ALLOCATOR>::DataWrapper::DataWrapper(
1889 const COMPARATOR& comparator,
1890 const ALLOCATOR& basicAllocator)
1891:
::bsl::set<KEY, COMPARATOR, ALLOCATOR>::Comparator(comparator)
1892, d_pool(basicAllocator)
1896template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
1898set<KEY, COMPARATOR, ALLOCATOR>::DataWrapper::DataWrapper(
1899 BloombergLP::bslmf::MovableRef<DataWrapper> original)
1900: ::
bsl::set<KEY, COMPARATOR, ALLOCATOR>::Comparator(
1901 MoveUtil::access(original).keyComparator())
1902, d_pool(MoveUtil::move(MoveUtil::access(original).d_pool))
1906template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
1908typename set<KEY, COMPARATOR, ALLOCATOR>::NodeFactory&
1909set<KEY, COMPARATOR, ALLOCATOR>::DataWrapper::nodeFactory()
1914template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
1916const typename set<KEY, COMPARATOR, ALLOCATOR>::NodeFactory&
1917set<KEY, COMPARATOR, ALLOCATOR>::DataWrapper::nodeFactory()
const
1927template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
1929typename set<KEY, COMPARATOR, ALLOCATOR>::NodeFactory&
1930set<KEY, COMPARATOR, ALLOCATOR>::nodeFactory()
1932 return d_compAndAlloc.nodeFactory();
1935template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
1937typename set<KEY, COMPARATOR, ALLOCATOR>::Comparator&
1938set<KEY, COMPARATOR, ALLOCATOR>::comparator()
1940 return d_compAndAlloc;
1943template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
1945void set<KEY, COMPARATOR, ALLOCATOR>::quickSwapExchangeAllocators(set& other)
1947 BloombergLP::bslalg::RbTreeUtil::swap(&d_tree, &other.d_tree);
1948 nodeFactory().swapExchangeAllocators(other.nodeFactory());
1956 if (
sizeof(NodeFactory) !=
sizeof(DataWrapper)) {
1957 comparator().swap(other.comparator());
1961template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
1963void set<KEY, COMPARATOR, ALLOCATOR>::quickSwapRetainAllocators(set& other)
1965 BloombergLP::bslalg::RbTreeUtil::swap(&d_tree, &other.d_tree);
1966 nodeFactory().swapRetainAllocators(other.nodeFactory());
1970 if (
sizeof(NodeFactory) !=
sizeof(DataWrapper)) {
1971 comparator().swap(other.comparator());
1975template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
1976template <
class INPUT_ITERATOR,
class SENTINEL>
1978void set<KEY, COMPARATOR, ALLOCATOR>::constructFromRange(INPUT_ITERATOR first,
1981 if (first == last) {
1986 BloombergLP::bslstl::IteratorUtil::
1987 canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()) {
1988 const size_type numElements =
static_cast<size_type
>(
1989 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last));
1990 nodeFactory().reserveNodes(numElements);
1993 BloombergLP::bslalg::RbTreeUtilTreeProctor<NodeFactory> proctor(
2004 BloombergLP::bslalg::RbTreeNode *prevNode = d_tree.rootNode();
2006 while (++first != last) {
2008 const value_type& value = *first;
2009 if (this->comparator()(value, *prevNode)) {
2012 insertFromRange(++first, last);
2016 if (this->comparator()(*prevNode, value)) {
2017 BloombergLP::bslalg::RbTreeNode *node =
2018 nodeFactory().emplaceIntoNewNode(value);
2019 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2030#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
2031 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
2033template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2034template <
class INPUT_ITERATOR,
class SENTINEL>
2036void set<KEY, COMPARATOR, ALLOCATOR>::constructFromRange(
2037 INPUT_ITERATOR first,
2043 !BloombergLP::bslstl::IteratorUtil
2044 ::canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()
2045 || numElements ==
static_cast<size_type
>(
2046 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last))));
2048 if (first == last) {
2052 if (0 < numElements) {
2053 nodeFactory().reserveNodes(numElements);
2056 BloombergLP::bslalg::RbTreeUtilTreeProctor<NodeFactory> proctor(
2066 insert(*first); --numElements;
2067 BloombergLP::bslalg::RbTreeNode *prevNode = d_tree.rootNode();
2069 while (++first != last) {
2071 const value_type& value = *first;
2072 if (this->comparator()(value, *prevNode)) {
2074 insert(value); --numElements;
2075 insertFromRange(++first, last, numElements);
2079 if (this->comparator()(*prevNode, value)) {
2080 BloombergLP::bslalg::RbTreeNode *node =
2081 nodeFactory().emplaceIntoNewNode(value);
2082 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2096template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2097template <
class INPUT_ITERATOR,
class SENTINEL>
2099void set<KEY, COMPARATOR, ALLOCATOR>::insertFromRange(INPUT_ITERATOR first,
2118 while (first != last) {
2120 if (BloombergLP::bslstl::IteratorUtil
2121 ::canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()
2123 !nodeFactory().hasFreeNodes())) {
2124 nodeFactory().reserveNodes(
2125 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last));
2133#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
2134 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
2136template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2137template <
class INPUT_ITERATOR,
class SENTINEL>
2139void set<KEY, COMPARATOR, ALLOCATOR>::insertFromRange(
2140 INPUT_ITERATOR first,
2145 !BloombergLP::bslstl::IteratorUtil
2146 ::canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()
2147 || numElements ==
static_cast<size_type
>(
2148 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last))));
2150 while (first != last) {
2153 !nodeFactory().hasFreeNodes())) {
2154 nodeFactory().reserveNodes(numElements);
2166template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2168const typename set<KEY, COMPARATOR, ALLOCATOR>::NodeFactory&
2169set<KEY, COMPARATOR, ALLOCATOR>::nodeFactory()
const
2171 return d_compAndAlloc.nodeFactory();
2174template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2176const typename set<KEY, COMPARATOR, ALLOCATOR>::Comparator&
2177set<KEY, COMPARATOR, ALLOCATOR>::comparator()
const
2179 return d_compAndAlloc;
2183template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2185set<KEY, COMPARATOR, ALLOCATOR>::set()
2186: d_compAndAlloc(COMPARATOR(), ALLOCATOR())
2191template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2193set<KEY, COMPARATOR, ALLOCATOR>::set(
const ALLOCATOR& basicAllocator)
2194: d_compAndAlloc(COMPARATOR(), basicAllocator)
2199template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2201set<KEY, COMPARATOR, ALLOCATOR>::set(
const set& original)
2202: d_compAndAlloc(original.comparator().keyComparator(),
2203 AllocatorTraits::select_on_container_copy_construction(
2204 original.nodeFactory().allocator()))
2207 if (0 < original.size()) {
2208 nodeFactory().reserveNodes(original.size());
2209 BloombergLP::bslalg::RbTreeUtil::copyTree(&d_tree,
2215template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2217set<KEY, COMPARATOR, ALLOCATOR>::set(
2218 BloombergLP::bslmf::MovableRef<set> original)
2219: d_compAndAlloc(MoveUtil::move(MoveUtil::access(original).d_compAndAlloc))
2222 set& lvalue = original;
2223 BloombergLP::bslalg::RbTreeUtil::swap(&d_tree, &lvalue.d_tree);
2226template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2228set<KEY, COMPARATOR, ALLOCATOR>::set(
2229 const set& original,
2230 const typename type_identity<ALLOCATOR>::type& basicAllocator)
2231: d_compAndAlloc(original.comparator().keyComparator(), basicAllocator)
2234 if (0 < original.size()) {
2235 nodeFactory().reserveNodes(original.size());
2236 BloombergLP::bslalg::RbTreeUtil::copyTree(&d_tree,
2242template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2244set<KEY, COMPARATOR, ALLOCATOR>::set(
2245 BloombergLP::bslmf::MovableRef<set> original,
2246 const typename type_identity<ALLOCATOR>::type& basicAllocator)
2247: d_compAndAlloc(MoveUtil::access(original).comparator().keyComparator(),
2251 set& lvalue = original;
2254 nodeFactory().allocator() == lvalue.nodeFactory().allocator())) {
2255 d_compAndAlloc.nodeFactory().adopt(
2256 MoveUtil::move(lvalue.d_compAndAlloc.nodeFactory()));
2257 BloombergLP::bslalg::RbTreeUtil::swap(&d_tree, &lvalue.d_tree);
2260 if (0 < lvalue.size()) {
2261 nodeFactory().reserveNodes(lvalue.size());
2262 BloombergLP::bslalg::RbTreeUtil::moveTree(&d_tree,
2265 &lvalue.nodeFactory());
2270template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2271template <
class INPUT_ITERATOR>
2273set<KEY, COMPARATOR, ALLOCATOR>::set(INPUT_ITERATOR first,
2274 INPUT_ITERATOR last,
2275 const COMPARATOR& comparator,
2276 const ALLOCATOR& basicAllocator)
2277: d_compAndAlloc(comparator, basicAllocator)
2280 if (first != last) {
2282 const size_type numElements =
static_cast<size_type
>(
2283 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last));
2285 if (0 < numElements) {
2286 nodeFactory().reserveNodes(numElements);
2289 BloombergLP::bslalg::RbTreeUtilTreeProctor<NodeFactory> proctor(
2300 BloombergLP::bslalg::RbTreeNode *prevNode = d_tree.rootNode();
2301 while (++first != last) {
2304 const value_type& value = *first;
2305 if (this->comparator()(value, *prevNode)) {
2307 insert(++first, last);
2311 if (this->comparator()(*prevNode, value)) {
2312 BloombergLP::bslalg::RbTreeNode *node =
2313 nodeFactory().emplaceIntoNewNode(value);
2314 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2326template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2327template <
class INPUT_ITERATOR>
2329set<KEY, COMPARATOR, ALLOCATOR>::set(INPUT_ITERATOR first,
2330 INPUT_ITERATOR last,
2331 const ALLOCATOR& basicAllocator)
2332: d_compAndAlloc(COMPARATOR(), basicAllocator)
2335 if (first != last) {
2337 const size_type numElements =
static_cast<size_type
>(
2338 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last));
2340 if (0 < numElements) {
2341 nodeFactory().reserveNodes(numElements);
2344 BloombergLP::bslalg::RbTreeUtilTreeProctor<NodeFactory> proctor(
2355 BloombergLP::bslalg::RbTreeNode *prevNode = d_tree.rootNode();
2356 while (++first != last) {
2359 const value_type& value = *first;
2360 if (this->comparator()(value, *prevNode)) {
2362 insert(++first, last);
2366 if (this->comparator()(*prevNode, value)) {
2367 BloombergLP::bslalg::RbTreeNode *node =
2368 nodeFactory().emplaceIntoNewNode(value);
2369 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2381#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2382template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2384set<KEY, COMPARATOR, ALLOCATOR>::set(std::initializer_list<KEY> values,
2385 const COMPARATOR& comparator,
2386 const ALLOCATOR& basicAllocator)
2387: set(values.
begin(), values.
end(), comparator, basicAllocator)
2391template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2393set<KEY, COMPARATOR, ALLOCATOR>::set(std::initializer_list<KEY> values,
2394 const ALLOCATOR& basicAllocator)
2395: set(values.
begin(), values.
end(), COMPARATOR(), basicAllocator)
2400template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2402set<KEY, COMPARATOR, ALLOCATOR>::~set()
2408template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2410set<KEY, COMPARATOR, ALLOCATOR>&
2411set<KEY, COMPARATOR, ALLOCATOR>::operator=(
const set& rhs)
2414 if (AllocatorTraits::propagate_on_container_copy_assignment::value) {
2415 set other(rhs,
rhs.nodeFactory().allocator());
2416 quickSwapExchangeAllocators(other);
2419 set other(rhs, nodeFactory().allocator());
2420 quickSwapRetainAllocators(other);
2426template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2428set<KEY, COMPARATOR, ALLOCATOR>&
2429set<KEY, COMPARATOR, ALLOCATOR>::operator=(
2430 BloombergLP::bslmf::MovableRef<set> rhs)
2432 AllocatorTraits::is_always_equal::value
2433 && std::is_nothrow_move_assignable<COMPARATOR>::value)
2438 if (nodeFactory().allocator() == lvalue.nodeFactory().allocator()) {
2439 set other(MoveUtil::move(lvalue));
2440 quickSwapRetainAllocators(other);
2443 AllocatorTraits::propagate_on_container_move_assignment::value) {
2444 set other(MoveUtil::move(lvalue));
2445 quickSwapExchangeAllocators(other);
2448 set other(MoveUtil::move(lvalue), nodeFactory().allocator());
2449 quickSwapRetainAllocators(other);
2455#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2456template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2458set<KEY, COMPARATOR, ALLOCATOR>&
2459set<KEY, COMPARATOR, ALLOCATOR>::operator=(std::initializer_list<KEY> values)
2462 insert(values.begin(), values.end());
2467template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2469typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
2472 return iterator(d_tree.firstNode());
2475template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2477typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
2480 return iterator(d_tree.sentinel());
2483template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2485typename set<KEY, COMPARATOR, ALLOCATOR>::reverse_iterator
2488 return reverse_iterator(
end());
2491template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2493typename set<KEY, COMPARATOR, ALLOCATOR>::reverse_iterator
2496 return reverse_iterator(
begin());
2499template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2501pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
2502set<KEY, COMPARATOR, ALLOCATOR>::insert(
const value_type& value)
2504 int comparisonResult;
2505 BloombergLP::bslalg::RbTreeNode *insertLocation =
2506 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2511 if (!comparisonResult) {
2512 return pair<iterator, bool>(iterator(insertLocation),
false);
2515 BloombergLP::bslalg::RbTreeNode *node =
2516 nodeFactory().emplaceIntoNewNode(value);
2517 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2519 comparisonResult < 0,
2521 return pair<iterator, bool>(iterator(node),
true);
2524template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2526pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
2527set<KEY, COMPARATOR, ALLOCATOR>::insert(
2528 BloombergLP::bslmf::MovableRef<value_type> value)
2530 value_type& lvalue = value;
2531 int comparisonResult;
2532 BloombergLP::bslalg::RbTreeNode *insertLocation =
2533 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2538 if (!comparisonResult) {
2539 return pair<iterator, bool>(iterator(insertLocation),
false);
2542 BloombergLP::bslalg::RbTreeNode *node =
2543 nodeFactory().emplaceIntoNewNode(MoveUtil::move(lvalue));
2544 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2546 comparisonResult < 0,
2548 return pair<iterator, bool>(iterator(node),
true);
2551template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2553typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
2554set<KEY, COMPARATOR, ALLOCATOR>::insert(const_iterator hint,
2555 const value_type& value)
2557 BloombergLP::bslalg::RbTreeNode *hintNode =
2558 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
2559 int comparisonResult;
2560 BloombergLP::bslalg::RbTreeNode *insertLocation =
2561 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2567 if (!comparisonResult) {
2568 return iterator(insertLocation);
2571 BloombergLP::bslalg::RbTreeNode *node =
2572 nodeFactory().emplaceIntoNewNode(value);
2573 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2575 comparisonResult < 0,
2577 return iterator(node);
2580template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2582typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
2583set<KEY, COMPARATOR, ALLOCATOR>::insert(const_iterator hint,
2584 BloombergLP::bslmf::MovableRef<value_type> value)
2586 value_type& lvalue = value;
2587 BloombergLP::bslalg::RbTreeNode *hintNode =
2588 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
2589 int comparisonResult;
2590 BloombergLP::bslalg::RbTreeNode *insertLocation =
2591 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2597 if (!comparisonResult) {
2598 return iterator(insertLocation);
2601 BloombergLP::bslalg::RbTreeNode *node =
2602 nodeFactory().emplaceIntoNewNode(MoveUtil::move(lvalue));
2604 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2606 comparisonResult < 0,
2608 return iterator(node);
2611template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2612template <
class INPUT_ITERATOR>
2614void set<KEY, COMPARATOR, ALLOCATOR>::insert(INPUT_ITERATOR first,
2615 INPUT_ITERATOR last)
2629 while (first != last) {
2630 if (BloombergLP::bslstl::IteratorUtil::
2631 canCalculateInsertDistance<INPUT_ITERATOR,INPUT_ITERATOR>()
2633 !nodeFactory().hasFreeNodes())) {
2634 const size_type numElements =
static_cast<size_type
>(
2635 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last));
2636 nodeFactory().reserveNodes(numElements);
2643#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2644template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2646void set<KEY, COMPARATOR, ALLOCATOR>::insert(std::initializer_list<KEY> values)
2648 insert(values.begin(), values.end());
2652#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
2655#ifndef BSLSTL_SET_VARIADIC_LIMIT
2656#define BSLSTL_SET_VARIADIC_LIMIT 10
2658#ifndef BSLSTL_SET_VARIADIC_LIMIT_D
2659#define BSLSTL_SET_VARIADIC_LIMIT_D BSLSTL_SET_VARIADIC_LIMIT
2661#if BSLSTL_SET_VARIADIC_LIMIT_D >= 0
2662template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2664pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
2665set<KEY, COMPARATOR, ALLOCATOR>::emplace(
2668 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
2670 int comparisonResult;
2671 BloombergLP::bslalg::RbTreeNode *insertLocation =
2672 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2676 static_cast<const Node *
>(node)->value());
2677 if (!comparisonResult) {
2678 nodeFactory().deleteNode(node);
2679 return pair<iterator, bool>(iterator(insertLocation),
false);
2681 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2683 comparisonResult < 0,
2685 return pair<iterator, bool>(iterator(node),
true);
2689#if BSLSTL_SET_VARIADIC_LIMIT_D >= 1
2690template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2691template <
class Args_01>
2693pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
2694set<KEY, COMPARATOR, ALLOCATOR>::emplace(
2697 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
2699 int comparisonResult;
2700 BloombergLP::bslalg::RbTreeNode *insertLocation =
2701 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2705 static_cast<const Node *
>(node)->value());
2706 if (!comparisonResult) {
2707 nodeFactory().deleteNode(node);
2708 return pair<iterator, bool>(iterator(insertLocation),
false);
2710 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2712 comparisonResult < 0,
2714 return pair<iterator, bool>(iterator(node),
true);
2718#if BSLSTL_SET_VARIADIC_LIMIT_D >= 2
2719template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2720template <
class Args_01,
2723pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
2724set<KEY, COMPARATOR, ALLOCATOR>::emplace(
2728 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
2731 int comparisonResult;
2732 BloombergLP::bslalg::RbTreeNode *insertLocation =
2733 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2737 static_cast<const Node *
>(node)->value());
2738 if (!comparisonResult) {
2739 nodeFactory().deleteNode(node);
2740 return pair<iterator, bool>(iterator(insertLocation),
false);
2742 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2744 comparisonResult < 0,
2746 return pair<iterator, bool>(iterator(node),
true);
2750#if BSLSTL_SET_VARIADIC_LIMIT_D >= 3
2751template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2752template <
class Args_01,
2756pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
2757set<KEY, COMPARATOR, ALLOCATOR>::emplace(
2762 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
2766 int comparisonResult;
2767 BloombergLP::bslalg::RbTreeNode *insertLocation =
2768 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2772 static_cast<const Node *
>(node)->value());
2773 if (!comparisonResult) {
2774 nodeFactory().deleteNode(node);
2775 return pair<iterator, bool>(iterator(insertLocation),
false);
2777 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2779 comparisonResult < 0,
2781 return pair<iterator, bool>(iterator(node),
true);
2785#if BSLSTL_SET_VARIADIC_LIMIT_D >= 4
2786template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2787template <
class Args_01,
2792pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
2793set<KEY, COMPARATOR, ALLOCATOR>::emplace(
2799 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
2804 int comparisonResult;
2805 BloombergLP::bslalg::RbTreeNode *insertLocation =
2806 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2810 static_cast<const Node *
>(node)->value());
2811 if (!comparisonResult) {
2812 nodeFactory().deleteNode(node);
2813 return pair<iterator, bool>(iterator(insertLocation),
false);
2815 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2817 comparisonResult < 0,
2819 return pair<iterator, bool>(iterator(node),
true);
2823#if BSLSTL_SET_VARIADIC_LIMIT_D >= 5
2824template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2825template <
class Args_01,
2831pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
2832set<KEY, COMPARATOR, ALLOCATOR>::emplace(
2839 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
2845 int comparisonResult;
2846 BloombergLP::bslalg::RbTreeNode *insertLocation =
2847 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2851 static_cast<const Node *
>(node)->value());
2852 if (!comparisonResult) {
2853 nodeFactory().deleteNode(node);
2854 return pair<iterator, bool>(iterator(insertLocation),
false);
2856 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2858 comparisonResult < 0,
2860 return pair<iterator, bool>(iterator(node),
true);
2864#if BSLSTL_SET_VARIADIC_LIMIT_D >= 6
2865template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2866template <
class Args_01,
2873pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
2874set<KEY, COMPARATOR, ALLOCATOR>::emplace(
2882 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
2889 int comparisonResult;
2890 BloombergLP::bslalg::RbTreeNode *insertLocation =
2891 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2895 static_cast<const Node *
>(node)->value());
2896 if (!comparisonResult) {
2897 nodeFactory().deleteNode(node);
2898 return pair<iterator, bool>(iterator(insertLocation),
false);
2900 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2902 comparisonResult < 0,
2904 return pair<iterator, bool>(iterator(node),
true);
2908#if BSLSTL_SET_VARIADIC_LIMIT_D >= 7
2909template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2910template <
class Args_01,
2918pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
2919set<KEY, COMPARATOR, ALLOCATOR>::emplace(
2928 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
2936 int comparisonResult;
2937 BloombergLP::bslalg::RbTreeNode *insertLocation =
2938 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2942 static_cast<const Node *
>(node)->value());
2943 if (!comparisonResult) {
2944 nodeFactory().deleteNode(node);
2945 return pair<iterator, bool>(iterator(insertLocation),
false);
2947 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2949 comparisonResult < 0,
2951 return pair<iterator, bool>(iterator(node),
true);
2955#if BSLSTL_SET_VARIADIC_LIMIT_D >= 8
2956template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
2957template <
class Args_01,
2966pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
2967set<KEY, COMPARATOR, ALLOCATOR>::emplace(
2977 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
2986 int comparisonResult;
2987 BloombergLP::bslalg::RbTreeNode *insertLocation =
2988 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2992 static_cast<const Node *
>(node)->value());
2993 if (!comparisonResult) {
2994 nodeFactory().deleteNode(node);
2995 return pair<iterator, bool>(iterator(insertLocation),
false);
2997 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2999 comparisonResult < 0,
3001 return pair<iterator, bool>(iterator(node),
true);
3005#if BSLSTL_SET_VARIADIC_LIMIT_D >= 9
3006template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3007template <
class Args_01,
3017pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
3018set<KEY, COMPARATOR, ALLOCATOR>::emplace(
3029 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3039 int comparisonResult;
3040 BloombergLP::bslalg::RbTreeNode *insertLocation =
3041 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3045 static_cast<const Node *
>(node)->value());
3046 if (!comparisonResult) {
3047 nodeFactory().deleteNode(node);
3048 return pair<iterator, bool>(iterator(insertLocation),
false);
3050 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3052 comparisonResult < 0,
3054 return pair<iterator, bool>(iterator(node),
true);
3058#if BSLSTL_SET_VARIADIC_LIMIT_D >= 10
3059template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3060template <
class Args_01,
3071pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
3072set<KEY, COMPARATOR, ALLOCATOR>::emplace(
3084 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3095 int comparisonResult;
3096 BloombergLP::bslalg::RbTreeNode *insertLocation =
3097 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3101 static_cast<const Node *
>(node)->value());
3102 if (!comparisonResult) {
3103 nodeFactory().deleteNode(node);
3104 return pair<iterator, bool>(iterator(insertLocation),
false);
3106 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3108 comparisonResult < 0,
3110 return pair<iterator, bool>(iterator(node),
true);
3115#if BSLSTL_SET_VARIADIC_LIMIT_D >= 0
3116template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3118typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3119set<KEY, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint)
3121 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3123 BloombergLP::bslalg::RbTreeNode *hintNode =
3124 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3125 int comparisonResult;
3126 BloombergLP::bslalg::RbTreeNode *insertLocation =
3127 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3131 static_cast<const Node *
>(node)->value(),
3133 if (!comparisonResult) {
3134 nodeFactory().deleteNode(node);
3135 return iterator(insertLocation);
3138 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3140 comparisonResult < 0,
3142 return iterator(node);
3146#if BSLSTL_SET_VARIADIC_LIMIT_D >= 1
3147template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3148template <
class Args_01>
3150typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3151set<KEY, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
3154 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3156 BloombergLP::bslalg::RbTreeNode *hintNode =
3157 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3158 int comparisonResult;
3159 BloombergLP::bslalg::RbTreeNode *insertLocation =
3160 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3164 static_cast<const Node *
>(node)->value(),
3166 if (!comparisonResult) {
3167 nodeFactory().deleteNode(node);
3168 return iterator(insertLocation);
3171 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3173 comparisonResult < 0,
3175 return iterator(node);
3179#if BSLSTL_SET_VARIADIC_LIMIT_D >= 2
3180template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3181template <
class Args_01,
3184typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3185set<KEY, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
3189 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3192 BloombergLP::bslalg::RbTreeNode *hintNode =
3193 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3194 int comparisonResult;
3195 BloombergLP::bslalg::RbTreeNode *insertLocation =
3196 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3200 static_cast<const Node *
>(node)->value(),
3202 if (!comparisonResult) {
3203 nodeFactory().deleteNode(node);
3204 return iterator(insertLocation);
3207 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3209 comparisonResult < 0,
3211 return iterator(node);
3215#if BSLSTL_SET_VARIADIC_LIMIT_D >= 3
3216template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3217template <
class Args_01,
3221typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3222set<KEY, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
3227 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3231 BloombergLP::bslalg::RbTreeNode *hintNode =
3232 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3233 int comparisonResult;
3234 BloombergLP::bslalg::RbTreeNode *insertLocation =
3235 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3239 static_cast<const Node *
>(node)->value(),
3241 if (!comparisonResult) {
3242 nodeFactory().deleteNode(node);
3243 return iterator(insertLocation);
3246 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3248 comparisonResult < 0,
3250 return iterator(node);
3254#if BSLSTL_SET_VARIADIC_LIMIT_D >= 4
3255template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3256template <
class Args_01,
3261typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3262set<KEY, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
3268 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3273 BloombergLP::bslalg::RbTreeNode *hintNode =
3274 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3275 int comparisonResult;
3276 BloombergLP::bslalg::RbTreeNode *insertLocation =
3277 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3281 static_cast<const Node *
>(node)->value(),
3283 if (!comparisonResult) {
3284 nodeFactory().deleteNode(node);
3285 return iterator(insertLocation);
3288 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3290 comparisonResult < 0,
3292 return iterator(node);
3296#if BSLSTL_SET_VARIADIC_LIMIT_D >= 5
3297template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3298template <
class Args_01,
3304typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3305set<KEY, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
3312 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3318 BloombergLP::bslalg::RbTreeNode *hintNode =
3319 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3320 int comparisonResult;
3321 BloombergLP::bslalg::RbTreeNode *insertLocation =
3322 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3326 static_cast<const Node *
>(node)->value(),
3328 if (!comparisonResult) {
3329 nodeFactory().deleteNode(node);
3330 return iterator(insertLocation);
3333 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3335 comparisonResult < 0,
3337 return iterator(node);
3341#if BSLSTL_SET_VARIADIC_LIMIT_D >= 6
3342template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3343template <
class Args_01,
3350typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3351set<KEY, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
3359 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3366 BloombergLP::bslalg::RbTreeNode *hintNode =
3367 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3368 int comparisonResult;
3369 BloombergLP::bslalg::RbTreeNode *insertLocation =
3370 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3374 static_cast<const Node *
>(node)->value(),
3376 if (!comparisonResult) {
3377 nodeFactory().deleteNode(node);
3378 return iterator(insertLocation);
3381 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3383 comparisonResult < 0,
3385 return iterator(node);
3389#if BSLSTL_SET_VARIADIC_LIMIT_D >= 7
3390template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3391template <
class Args_01,
3399typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3400set<KEY, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
3409 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3417 BloombergLP::bslalg::RbTreeNode *hintNode =
3418 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3419 int comparisonResult;
3420 BloombergLP::bslalg::RbTreeNode *insertLocation =
3421 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3425 static_cast<const Node *
>(node)->value(),
3427 if (!comparisonResult) {
3428 nodeFactory().deleteNode(node);
3429 return iterator(insertLocation);
3432 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3434 comparisonResult < 0,
3436 return iterator(node);
3440#if BSLSTL_SET_VARIADIC_LIMIT_D >= 8
3441template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3442template <
class Args_01,
3451typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3452set<KEY, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
3462 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3471 BloombergLP::bslalg::RbTreeNode *hintNode =
3472 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3473 int comparisonResult;
3474 BloombergLP::bslalg::RbTreeNode *insertLocation =
3475 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3479 static_cast<const Node *
>(node)->value(),
3481 if (!comparisonResult) {
3482 nodeFactory().deleteNode(node);
3483 return iterator(insertLocation);
3486 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3488 comparisonResult < 0,
3490 return iterator(node);
3494#if BSLSTL_SET_VARIADIC_LIMIT_D >= 9
3495template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3496template <
class Args_01,
3506typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3507set<KEY, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
3518 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3528 BloombergLP::bslalg::RbTreeNode *hintNode =
3529 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3530 int comparisonResult;
3531 BloombergLP::bslalg::RbTreeNode *insertLocation =
3532 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3536 static_cast<const Node *
>(node)->value(),
3538 if (!comparisonResult) {
3539 nodeFactory().deleteNode(node);
3540 return iterator(insertLocation);
3543 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3545 comparisonResult < 0,
3547 return iterator(node);
3551#if BSLSTL_SET_VARIADIC_LIMIT_D >= 10
3552template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3553template <
class Args_01,
3564typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3565set<KEY, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
3577 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3588 BloombergLP::bslalg::RbTreeNode *hintNode =
3589 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3590 int comparisonResult;
3591 BloombergLP::bslalg::RbTreeNode *insertLocation =
3592 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3596 static_cast<const Node *
>(node)->value(),
3598 if (!comparisonResult) {
3599 nodeFactory().deleteNode(node);
3600 return iterator(insertLocation);
3603 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3605 comparisonResult < 0,
3607 return iterator(node);
3614template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3615template <
class... Args>
3617pair<typename set<KEY, COMPARATOR, ALLOCATOR>::iterator,
bool>
3618set<KEY, COMPARATOR, ALLOCATOR>::emplace(
3621 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3623 int comparisonResult;
3624 BloombergLP::bslalg::RbTreeNode *insertLocation =
3625 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3629 static_cast<const Node *
>(node)->value());
3630 if (!comparisonResult) {
3631 nodeFactory().deleteNode(node);
3632 return pair<iterator, bool>(iterator(insertLocation),
false);
3634 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3636 comparisonResult < 0,
3638 return pair<iterator, bool>(iterator(node),
true);
3641template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3642template <
class... Args>
3644typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3645set<KEY, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
3648 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3650 BloombergLP::bslalg::RbTreeNode *hintNode =
3651 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3652 int comparisonResult;
3653 BloombergLP::bslalg::RbTreeNode *insertLocation =
3654 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3658 static_cast<const Node *
>(node)->value(),
3660 if (!comparisonResult) {
3661 nodeFactory().deleteNode(node);
3662 return iterator(insertLocation);
3665 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3667 comparisonResult < 0,
3669 return iterator(node);
3674template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3676typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3677set<KEY, COMPARATOR, ALLOCATOR>::erase(const_iterator position)
3681 BloombergLP::bslalg::RbTreeNode *node =
3682 const_cast<BloombergLP::bslalg::RbTreeNode *
>(position.node());
3683 BloombergLP::bslalg::RbTreeNode *result =
3684 BloombergLP::bslalg::RbTreeUtil::next(node);
3685 BloombergLP::bslalg::RbTreeUtil::remove(&d_tree, node);
3686 nodeFactory().deleteNode(node);
3687 return iterator(result);
3690template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3692typename set<KEY, COMPARATOR, ALLOCATOR>::size_type
3693set<KEY, COMPARATOR, ALLOCATOR>::erase(
const key_type& key)
3695 const_iterator it = find(key);
3703template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3705typename set<KEY, COMPARATOR, ALLOCATOR>::iterator
3706set<KEY, COMPARATOR, ALLOCATOR>::erase(const_iterator first,
3707 const_iterator last)
3709 while (first != last) {
3710 first =
erase(first);
3712 return iterator(last.node());
3715template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3717void set<KEY, COMPARATOR, ALLOCATOR>::swap(set& other)
3719 AllocatorTraits::is_always_equal::value
3720 && bsl::is_nothrow_swappable<COMPARATOR>::value)
3722 if (AllocatorTraits::propagate_on_container_swap::value) {
3723 quickSwapExchangeAllocators(other);
3730 nodeFactory().allocator() == other.nodeFactory().allocator())) {
3731 quickSwapRetainAllocators(other);
3736 set toOtherCopy(MoveUtil::move(*
this),
3737 other.nodeFactory().allocator());
3738 set toThisCopy(MoveUtil::move(other), nodeFactory().allocator());
3740 this->quickSwapRetainAllocators(toThisCopy);
3741 other.quickSwapRetainAllocators(toOtherCopy);
3746template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3752 if (d_tree.rootNode()) {
3756 BloombergLP::bslalg::RbTreeUtil::deleteTree(&d_tree, &nodeFactory());
3758#if defined(BSLS_ASSERT_SAFE_IS_USED)
3767template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3769typename set<KEY, COMPARATOR, ALLOCATOR>::allocator_type
3772 return nodeFactory().allocator();
3775template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3777typename set<KEY, COMPARATOR, ALLOCATOR>::const_iterator
3783template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3785typename set<KEY, COMPARATOR, ALLOCATOR>::const_iterator
3791template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3793typename set<KEY, COMPARATOR, ALLOCATOR>::const_reverse_iterator
3799template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3801typename set<KEY, COMPARATOR, ALLOCATOR>::const_reverse_iterator
3807template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3809typename set<KEY, COMPARATOR, ALLOCATOR>::const_iterator
3812 return const_iterator(d_tree.firstNode());
3815template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3817typename set<KEY, COMPARATOR, ALLOCATOR>::const_iterator
3820 return const_iterator(d_tree.sentinel());
3823template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3825typename set<KEY, COMPARATOR, ALLOCATOR>::const_reverse_iterator
3828 return const_reverse_iterator(
end());
3831template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3833typename set<KEY, COMPARATOR, ALLOCATOR>::const_reverse_iterator
3836 return const_reverse_iterator(
begin());
3839template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3841bool set<KEY, COMPARATOR, ALLOCATOR>::contains(
const key_type& key)
const
3843 return find(key) !=
end();
3847template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3851 return 0 == d_tree.numNodes();
3854template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3856typename set<KEY, COMPARATOR, ALLOCATOR>::size_type
3859 return d_tree.numNodes();
3862template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3864typename set<KEY, COMPARATOR, ALLOCATOR>::size_type
3867 return AllocatorTraits::max_size(get_allocator());
3870template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3872typename set<KEY, COMPARATOR, ALLOCATOR>::key_compare
3873set<KEY, COMPARATOR, ALLOCATOR>::key_comp()
const
3875 return comparator().keyComparator();
3878template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3880typename set<KEY, COMPARATOR, ALLOCATOR>::value_compare
3881set<KEY, COMPARATOR, ALLOCATOR>::value_comp()
const
3883 return value_compare(key_comp());
3889template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3894 return BloombergLP::bslalg::RangeCompare::equal(
lhs.begin(),
3902#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
3903template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3912#ifdef BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
3914template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3916BloombergLP::bslalg::SynthThreeWayUtil::Result<KEY>
3917bsl::operator<=>(
const set<KEY, COMPARATOR, ALLOCATOR>& lhs,
3918 const set<KEY, COMPARATOR, ALLOCATOR>& rhs)
3920 return bsl::lexicographical_compare_three_way(
3925 BloombergLP::bslalg::SynthThreeWayUtil::compare);
3930template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3935 return 0 > BloombergLP::bslalg::RangeCompare::lexicographical(
lhs.begin(),
3943template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3951template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3959template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
3970template <
class KEY,
class COMPARATOR,
class ALLOCATOR,
class PREDICATE>
3973bsl::erase_if(set<KEY, COMPARATOR, ALLOCATOR>& s, PREDICATE predicate)
3975 return BloombergLP::bslstl::AlgorithmUtil::containerEraseIf(s, predicate);
3978template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
4001template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
4002struct HasStlIterators<
bsl::set<KEY, COMPARATOR, ALLOCATOR> >
4010template <
class KEY,
class COMPARATOR,
class ALLOCATOR>
4011struct UsesBslmaAllocator<
bsl::set<KEY, COMPARATOR, ALLOCATOR> >
4020# error Not valid except when included from bslstl_set.h
Definition bslma_bslallocator.h:588
Definition bslstl_set.h:691
pair< iterator, bool > insert(const value_type &value)
Definition bslstl_set.h:2834
bool empty() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_set.h:3219
iterator lower_bound(const key_type &key)
Definition bslstl_set.h:1522
void swap(set &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits void clear() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_set.h:1476
set &operator=(BloombergLP::bslmf::MovableRef< set > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_set.h:2802
size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the number of elements in this set.
Definition bslstl_set.h:3227
iterator find(const key_type &key)
Definition bslstl_set.h:1488
const value_type & const_reference
Definition bslstl_set.h:784
void insert_range(BSLS_COMPILERFEATURES_FORWARD_REF(RANGE) range)
Definition bslstl_set.h:1342
const_reverse_iterator crbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_set.h:3196
ALLOCATOR allocator_type
Definition bslstl_set.h:782
set & operator=(const set &rhs)
Definition bslstl_set.h:2743
value_type & reference
Definition bslstl_set.h:783
reverse_iterator rbegin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_set.h:2818
KEY key_type
Definition bslstl_set.h:778
BloombergLP::bslstl::TreeIterator< const value_type, Node, difference_type > iterator
Definition bslstl_set.h:793
size_type max_size() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_set.h:3235
const_reverse_iterator crend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_set.h:3204
value_compare value_comp() const
Definition bslstl_set.h:3251
AllocatorTraits::pointer pointer
Definition bslstl_set.h:788
AllocatorTraits::difference_type difference_type
Definition bslstl_set.h:787
AllocatorTraits::size_type size_type
Definition bslstl_set.h:786
reverse_iterator rend() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_set.h:2826
~set()
Destroy this object.
Definition bslstl_set.h:2734
BloombergLP::bslstl::TreeIterator< const value_type, Node, difference_type > const_iterator
Definition bslstl_set.h:796
COMPARATOR key_compare
Definition bslstl_set.h:780
key_compare key_comp() const
Definition bslstl_set.h:3243
allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_set.h:3140
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_set.h:2810
pair< iterator, iterator > equal_range(const key_type &key)
Definition bslstl_set.h:1600
const_iterator cbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_set.h:3180
bsl::reverse_iterator< const_iterator > const_reverse_iterator
Definition bslstl_set.h:798
bool contains(const key_type &key) const
Definition bslstl_set.h:3211
set()
Definition bslstl_set.h:2517
bsl::reverse_iterator< iterator > reverse_iterator
Definition bslstl_set.h:797
iterator upper_bound(const key_type &key)
Definition bslstl_set.h:1560
size_type count(const key_type &key) const
Definition bslstl_set.h:1783
AllocatorTraits::const_pointer const_pointer
Definition bslstl_set.h:789
COMPARATOR value_compare
Definition bslstl_set.h:781
iterator emplace_hint(const_iterator hint, Args &&... arguments)
Definition bslstl_set.h:3016
KEY value_type
Definition bslstl_set.h:779
pair< iterator, bool > emplace(Args &&... arguments)
iterator erase(const_iterator position)
Definition bslstl_set.h:3047
const_iterator cend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_set.h:3188
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2343
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2349
#define BSLS_KEYWORD_CONSTEXPR_CPP17
Definition bsls_keyword.h:639
#define BSLS_KEYWORD_NOEXCEPT_OPERATOR(...)
Definition bsls_keyword.h:677
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:676
#define BSLSTL_SET_REQUIRES_CONTAINER_COMPATIBLE_RANGE(R, T)
Definition bslstl_set.h:653
void swap(OptionValue &a, OptionValue &b)
Definition bdlat_valuetypefunctions.h:939
void swap(array< VALUE_TYPE, SIZE > &lhs, array< VALUE_TYPE, SIZE > &rhs)
T::const_iterator cend(const T &container)
Definition bslstl_iterator.h:1709
bool operator<(const array< VALUE_TYPE, SIZE > &lhs, const array< VALUE_TYPE, SIZE > &rhs)
T::const_reverse_iterator crbegin(const T &container)
Definition bslstl_iterator.h:1695
bool operator>(const array< VALUE_TYPE, SIZE > &lhs, const array< VALUE_TYPE, SIZE > &rhs)
bool operator>=(const array< VALUE_TYPE, SIZE > &lhs, const array< VALUE_TYPE, SIZE > &rhs)
bool operator<=(const array< VALUE_TYPE, SIZE > &lhs, const array< VALUE_TYPE, SIZE > &rhs)
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
deque< VALUE_TYPE, ALLOCATOR >::size_type erase(deque< VALUE_TYPE, ALLOCATOR > &deq, const BDE_OTHER_TYPE &value)
Definition bslstl_deque.h:4424
T::iterator begin(T &container)
Definition bslstl_iterator.h:1593
const from_range_t from_range
bool operator==(const memory_resource &a, const memory_resource &b)
T::const_iterator cbegin(const T &container)
Definition bslstl_iterator.h:1651
ALLOCATOR & lhs
Definition bslstl_string.h:3917
T::iterator end(T &container)
Definition bslstl_iterator.h:1621
deque< VALUE_TYPE, ALLOCATOR >::size_type erase_if(deque< VALUE_TYPE, ALLOCATOR > &deq, PREDICATE predicate)
Definition bslstl_deque.h:4433
bool operator!=(const memory_resource &a, const memory_resource &b)
T::const_reverse_iterator crend(const T &container)
Definition bslstl_iterator.h:1752
Definition bdlc_flathashmap.h:2218
Definition baljsn_encoder_testtypes.h:76
Definition bdlbb_blob.h:579
Definition bslma_allocatortraits.h:1089
BloombergLP::bslma::AllocatorTraits_ConstPointerType< ALLOCATOR >::type const_pointer
Definition bslma_allocatortraits.h:1183
BloombergLP::bslma::AllocatorTraits_SizeType< ALLOCATOR >::type size_type
Definition bslma_allocatortraits.h:1196
BloombergLP::bslma::AllocatorTraits_PointerType< ALLOCATOR >::type pointer
Definition bslma_allocatortraits.h:1180
BloombergLP::bslma::AllocatorTraits_DifferenceType< ALLOCATOR >::type difference_type
Definition bslma_allocatortraits.h:1193
Definition bslmf_enableif.h:530
Definition bslstl_ranges.h:301
Definition bslmf_isconvertible.h:875