8#ifndef INCLUDED_BSLSTL_MAP
9#define INCLUDED_BSLSTL_MAP
522#include <bslscm_version.h>
566#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
567# include <initializer_list>
570#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
575#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
579#ifdef BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER
580#include <type_traits>
581 #ifndef BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES
582 #error Rvalue references curiously absent despite native 'type_traits'.
586#if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
590# define COMPILING_BSLSTL_MAP_H
592# undef COMPILING_BSLSTL_MAP_H
617 class COMPARATOR = std::less<KEY>,
618 class ALLOCATOR = allocator<pair<const KEY, VALUE> > >
629 typedef BloombergLP::bslstl::MapComparator<KEY, VALUE, COMPARATOR>
634 typedef BloombergLP::bslstl::TreeNode<ValueType> Node;
638 typedef BloombergLP::bslstl::TreeNodePool<ValueType, ALLOCATOR>
647 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
658 class DataWrapper :
public Comparator {
665 DataWrapper(
const DataWrapper&);
666 DataWrapper& operator=(
const DataWrapper&);
674 DataWrapper(
const COMPARATOR& comparator,
675 const ALLOCATOR& basicAllocator);
683 BloombergLP::bslmf::MovableRef<DataWrapper> original);
689 NodeFactory& nodeFactory();
695 const NodeFactory& nodeFactory()
const;
699 DataWrapper d_compAndAlloc;
703 BloombergLP::bslalg::RbTreeAnchor d_tree;
721 typedef BloombergLP::bslstl::TreeIterator<
723 typedef BloombergLP::bslstl::TreeIterator<
750 value_compare(COMPARATOR comparator);
798 static Node *toNode(BloombergLP::bslalg::RbTreeNode *node);
803 static const Node *toNode(
const BloombergLP::bslalg::RbTreeNode *node);
809 NodeFactory& nodeFactory();
813 Comparator& comparator();
820 void quickSwapExchangeAllocators(
map& other);
828 void quickSwapRetainAllocators(
map& other);
834 const NodeFactory& nodeFactory()
const;
838 const Comparator& comparator()
const;
855 explicit map(
const COMPARATOR& comparator,
856 const ALLOCATOR& basicAllocator = ALLOCATOR())
857 : d_compAndAlloc(comparator, basicAllocator)
873 explicit map(
const ALLOCATOR& basicAllocator);
893 map(BloombergLP::bslmf::MovableRef<map> original);
918 map(BloombergLP::bslmf::MovableRef<map> original,
948 template <
class INPUT_ITERATOR>
951 const COMPARATOR& comparator = COMPARATOR(),
952 const ALLOCATOR& basicAllocator = ALLOCATOR());
953 template <
class INPUT_ITERATOR>
956 const ALLOCATOR& basicAllocator);
958#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
959 map(std::initializer_list<value_type> values,
960 const COMPARATOR& comparator = COMPARATOR(),
961 const ALLOCATOR& basicAllocator = ALLOCATOR());
981 map(std::initializer_list<value_type> values,
982 const ALLOCATOR& basicAllocator);
1001 map&
operator=(BloombergLP::bslmf::MovableRef<map> rhs)
1003 AllocatorTraits::is_always_equal::value &&
1004 std::is_nothrow_move_assignable<COMPARATOR>::value);
1020#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1029 map&
operator=(std::initializer_list<value_type> values);
1053 BloombergLP::bslmf::MovableRef<key_type> key);
1109#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
1110 template <
class ALT_VALUE_TYPE>
1112#elif !defined(BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER)
1113 template <
class ALT_VALUE_TYPE>
1130 template <
class ALT_VALUE_TYPE>
1132 ALT_VALUE_TYPE&&>::value,
1175 BloombergLP::bslmf::MovableRef<value_type> value);
1177#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
1178 template <
class ALT_VALUE_TYPE>
1180#elif !defined(BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER)
1181 template <
class ALT_VALUE_TYPE>
1202 template <
class ALT_VALUE_TYPE>
1204 ALT_VALUE_TYPE&&>::value,
1232 template <
class INPUT_ITERATOR>
1233 void insert(INPUT_ITERATOR first, INPUT_ITERATOR last);
1235#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
1250#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1257 void insert(std::initializer_list<value_type> values);
1260#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
1269 template <
class BDE_OTHER_TYPE>
1271 BDE_OTHER_TYPE&& obj);
1281 template <
class BDE_OTHER_TYPE>
1283 BloombergLP::bslmf::MovableRef<KEY> key,
1284 BDE_OTHER_TYPE&& obj);
1294 template <
class BDE_OTHER_TYPE>
1297 BDE_OTHER_TYPE&& obj);
1308 template <
class BDE_OTHER_TYPE>
1310 BloombergLP::bslmf::MovableRef<KEY> key,
1311 BDE_OTHER_TYPE&& obj);
1314#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
1329 template <
class... Args>
1350 template <
class... Args>
1384 AllocatorTraits::is_always_equal::value &&
1385 bsl::is_nothrow_swappable<COMPARATOR>::value);
1404#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
1415 template <
class... Args>
1417 template <
class... Args>
1420 template<
class LOOKUP_KEY,
class... Args>
1422 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1423 LOOKUP_KEY>::value &&
1429 const LOOKUP_KEY& lvalue = key;
1431 int comparisonResult;
1432 BloombergLP::bslalg::RbTreeNode *insertLocation =
1433 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
1438 if (!comparisonResult) {
1443 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
1444 BloombergLP::bslalg::RbTreeNode *node =
1445 nodeFactory().emplaceIntoNewNode(
1446 std::piecewise_construct,
1447 std::forward_as_tuple(std::forward<LOOKUP_KEY>(key)),
1448 std::forward_as_tuple(std::forward<Args>(args)...));
1450 BloombergLP::bslalg::RbTreeNode *node =
1451 nodeFactory().emplaceIntoNewNode(
1452 std::forward<LOOKUP_KEY>(key),
1456 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
1458 comparisonResult < 0,
1475 template<
class... Args>
1477 template <
class... Args>
1479 BloombergLP::bslmf::MovableRef<KEY> key,
1481 template<
class LOOKUP_KEY,
class... Args>
1483 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1488 const LOOKUP_KEY& lvalue = key;
1490 BloombergLP::bslalg::RbTreeNode *hintNode =
1491 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
1493 int comparisonResult;
1494 BloombergLP::bslalg::RbTreeNode *insertLocation =
1495 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
1502 if (!comparisonResult) {
1506 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
1507 BloombergLP::bslalg::RbTreeNode *node =
1508 nodeFactory().emplaceIntoNewNode(
1509 std::piecewise_construct,
1510 std::forward_as_tuple(std::forward<LOOKUP_KEY>(key)),
1511 std::forward_as_tuple(std::forward<Args>(args)...));
1513 BloombergLP::bslalg::RbTreeNode *node =
1514 nodeFactory().emplaceIntoNewNode(
1515 std::forward<LOOKUP_KEY>(key),
1519 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
1521 comparisonResult < 0,
1544 return iterator(BloombergLP::bslalg::RbTreeUtil::find(
1545 d_tree, this->comparator(), key));
1554 template <
class LOOKUP_KEY>
1556 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1561 return iterator(BloombergLP::bslalg::RbTreeUtil::find(
1562 d_tree, this->comparator(), key));
1577 return iterator(BloombergLP::bslalg::RbTreeUtil::lowerBound(
1578 d_tree, this->comparator(), key));
1591 template <
class LOOKUP_KEY>
1593 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1598 return iterator(BloombergLP::bslalg::RbTreeUtil::lowerBound(
1599 d_tree, this->comparator(), key));
1614 return iterator(BloombergLP::bslalg::RbTreeUtil::upperBound(
1615 d_tree, this->comparator(), key));
1628 template <
class LOOKUP_KEY>
1630 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1635 return iterator(BloombergLP::bslalg::RbTreeUtil::upperBound(
1636 d_tree, this->comparator(), key));
1655 if (endIt !=
end() && !comparator()(key, *endIt.node())) {
1676 template <
class LOOKUP_KEY>
1678 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1685 if (endIt !=
end() && !comparator()(key, *endIt.node())) {
1693 if (endIt !=
end() && !comparator()(key, *endIt.node())) {
1756 template <class LOOKUP_KEY>
1758 BloombergLP::
bslmf::IsTransparentPredicate<COMPARATOR,
1814 d_tree, this->comparator(), key));
1823 template <
class LOOKUP_KEY>
1825 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1831 d_tree, this->comparator(), key));
1841 return (
find(key) !=
end()) ? 1 : 0;
1852 template <
class LOOKUP_KEY>
1854 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1862 while (it !=
end() && !comparator()(key, *it.node())) {
1881 return iterator(BloombergLP::bslalg::RbTreeUtil::lowerBound(
1882 d_tree, this->comparator(), key));
1895 template <
class LOOKUP_KEY>
1897 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1903 BloombergLP::bslalg::RbTreeUtil::lowerBound(d_tree,
1920 return const_iterator(BloombergLP::bslalg::RbTreeUtil::upperBound(
1921 d_tree, this->comparator(), key));
1934 template <
class LOOKUP_KEY>
1936 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1941 return const_iterator(BloombergLP::bslalg::RbTreeUtil::upperBound(
1942 d_tree, this->comparator(), key));
1961 if (endIt !=
end() && !comparator()(key, *endIt.node())) {
1982 template <
class LOOKUP_KEY>
1984 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1991 if (endIt !=
end() && !comparator()(key, *endIt.node())) {
1999 if (endIt !=
end() && !comparator()(key, *endIt.node())) {
2009#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2019 class INPUT_ITERATOR,
2020 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
2022 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
2023 class COMPARATOR = std::less<KEY>,
2025 BloombergLP::bslstl::IteratorUtil::IterToAlloc_t<INPUT_ITERATOR>>,
2026 class = bsl::enable_if_t<!bsl::IsStdAllocator_v<COMPARATOR>>,
2027 class = bsl::enable_if_t<
bsl::IsStdAllocator_v<ALLOCATOR>>
2031 COMPARATOR = COMPARATOR(),
2032 ALLOCATOR = ALLOCATOR())
2033-> map<KEY, VALUE, COMPARATOR, ALLOCATOR>;
2042 class INPUT_ITERATOR,
2045 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
2047 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
2048 class DEFAULT_ALLOCATOR = bsl::allocator<pair<const KEY, VALUE>>,
2049 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
2051map(INPUT_ITERATOR, INPUT_ITERATOR, COMPARATOR, ALLOC *)
2052-> map<KEY, VALUE, COMPARATOR>;
2059 class INPUT_ITERATOR,
2061 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
2063 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
2064 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
2066map(INPUT_ITERATOR, INPUT_ITERATOR, ALLOCATOR)
2067-> map<KEY, VALUE, std::less<KEY>, ALLOCATOR>;
2074 class INPUT_ITERATOR,
2076 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
2078 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
2079 class DEFAULT_ALLOCATOR = bsl::allocator<pair<const KEY, VALUE>>,
2080 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
2082map(INPUT_ITERATOR, INPUT_ITERATOR, ALLOC *)
2094 class COMPARATOR = std::less<KEY>,
2095 class ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
2096 class = bsl::enable_if_t<!bsl::IsStdAllocator_v<COMPARATOR>>,
2097 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
2099map(std::initializer_list<pair<const KEY, VALUE>>,
2100 COMPARATOR = COMPARATOR(),
2101 ALLOCATOR = ALLOCATOR())
2102-> map<KEY, VALUE, COMPARATOR, ALLOCATOR>;
2115 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
2116 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
2118map(std::initializer_list<pair<const KEY, VALUE>>, COMPARATOR, ALLOC *)
2119-> map<KEY, VALUE, COMPARATOR>;
2130 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
2132map(std::initializer_list<pair<const KEY, VALUE>>, ALLOCATOR)
2133-> map<KEY, VALUE, std::less<KEY>, ALLOCATOR>;
2143 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
2144 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
2146map(std::initializer_list<pair<const KEY, VALUE>>, ALLOC *)
2160template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
2161bool operator==(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
2162 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
2164#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
2165template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
2166bool operator!=(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
2167 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
2178#ifdef BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
2184template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
2185BloombergLP::bslalg::SynthThreeWayUtil::Result<pair<const KEY, VALUE>>
2186operator<=>(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
2187 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
2191template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
2192bool operator<(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
2193 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
2206template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
2207bool operator>(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
2208 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
2217template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
2218bool operator<=(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
2219 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
2228template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
2229bool operator>=(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
2230 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
2250typename
map<KEY, VALUE, COMPARATOR, ALLOCATOR>::size_type
2251erase_if(map<KEY, VALUE, COMPARATOR, ALLOCATOR>& m, PREDICATE predicate);
2270template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
2271void swap(map<KEY, VALUE, COMPARATOR, ALLOCATOR>& a,
2272 map<KEY, VALUE, COMPARATOR, ALLOCATOR>& b)
2284template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
2286map<KEY, VALUE, COMPARATOR, ALLOCATOR>::DataWrapper::DataWrapper(
2287 const COMPARATOR& comparator,
2288 const ALLOCATOR& basicAllocator)
2289:
::bsl::map<KEY, VALUE, COMPARATOR, ALLOCATOR>::Comparator(comparator)
2290, d_pool(basicAllocator)
2294template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2296map<KEY, VALUE, COMPARATOR, ALLOCATOR>::DataWrapper::DataWrapper(
2297 BloombergLP::bslmf::MovableRef<DataWrapper> original)
2298: ::
bsl::map<KEY, VALUE, COMPARATOR, ALLOCATOR>::Comparator(
2299 MoveUtil::access(original).keyComparator())
2300, d_pool(MoveUtil::move(MoveUtil::access(original).d_pool))
2304template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2306typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::NodeFactory&
2307map<KEY, VALUE, COMPARATOR, ALLOCATOR>::DataWrapper::nodeFactory()
2313template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2315const typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::NodeFactory&
2316map<KEY, VALUE, COMPARATOR, ALLOCATOR>::DataWrapper::nodeFactory()
const
2326template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2329 COMPARATOR comparator)
2335template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2349template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2351typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::Node *
2353 BloombergLP::bslalg::RbTreeNode *node)
2355 return static_cast<Node *
>(node);
2358template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2360const typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::Node *
2362 const BloombergLP::bslalg::RbTreeNode *node)
2364 return static_cast<const Node *
>(node);
2368template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2370typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::NodeFactory&
2371map<KEY, VALUE, COMPARATOR, ALLOCATOR>::nodeFactory()
2373 return d_compAndAlloc.nodeFactory();
2376template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2378typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::Comparator&
2379map<KEY, VALUE, COMPARATOR, ALLOCATOR>::comparator()
2381 return d_compAndAlloc;
2384template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2386void map<KEY, VALUE, COMPARATOR, ALLOCATOR>::quickSwapExchangeAllocators(
2389 BloombergLP::bslalg::RbTreeUtil::swap(&d_tree, &other.d_tree);
2390 nodeFactory().swapExchangeAllocators(other.nodeFactory());
2398 if (
sizeof(NodeFactory) !=
sizeof(DataWrapper)) {
2399 comparator().swap(other.comparator());
2403template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2405void map<KEY, VALUE, COMPARATOR, ALLOCATOR>::quickSwapRetainAllocators(
2408 BloombergLP::bslalg::RbTreeUtil::swap(&d_tree, &other.d_tree);
2409 nodeFactory().swapRetainAllocators(other.nodeFactory());
2413 if (
sizeof(NodeFactory) !=
sizeof(DataWrapper)) {
2414 comparator().swap(other.comparator());
2419template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2421const typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::NodeFactory&
2422map<KEY, VALUE, COMPARATOR, ALLOCATOR>::nodeFactory()
const
2424 return d_compAndAlloc.nodeFactory();
2427template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2429const typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::Comparator&
2430map<KEY, VALUE, COMPARATOR, ALLOCATOR>::comparator()
const
2432 return d_compAndAlloc;
2436template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2439: d_compAndAlloc(COMPARATOR(), ALLOCATOR())
2444template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2447: d_compAndAlloc(COMPARATOR(), basicAllocator)
2452template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2455: d_compAndAlloc(original.comparator().keyComparator(),
2460 if (0 < original.
size()) {
2461 nodeFactory().reserveNodes(original.
size());
2462 BloombergLP::bslalg::RbTreeUtil::copyTree(&d_tree,
2468template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2471 BloombergLP::bslmf::MovableRef<map> original)
2472: d_compAndAlloc(MoveUtil::move(MoveUtil::access(original).d_compAndAlloc))
2475 map& lvalue = original;
2476 BloombergLP::bslalg::RbTreeUtil::swap(&d_tree, &lvalue.d_tree);
2479template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2483: d_compAndAlloc(original.comparator().keyComparator(), basicAllocator)
2486 if (0 < original.
size()) {
2487 nodeFactory().reserveNodes(original.
size());
2488 BloombergLP::bslalg::RbTreeUtil::copyTree(&d_tree,
2494template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2497 BloombergLP::bslmf::MovableRef<map> original,
2499: d_compAndAlloc(MoveUtil::access(original).comparator().keyComparator(),
2503 map& lvalue = original;
2506 nodeFactory().
allocator() == lvalue.nodeFactory().allocator())) {
2507 d_compAndAlloc.nodeFactory().adopt(
2508 MoveUtil::move(lvalue.d_compAndAlloc.nodeFactory()));
2509 BloombergLP::bslalg::RbTreeUtil::swap(&d_tree, &lvalue.d_tree);
2511 else if (0 < lvalue.
size()) {
2512 nodeFactory().reserveNodes(lvalue.
size());
2513 BloombergLP::bslalg::RbTreeUtil::moveTree(&d_tree,
2516 &lvalue.nodeFactory());
2520template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2521template <
class INPUT_ITERATOR>
2524 INPUT_ITERATOR last,
2525 const COMPARATOR& comparator,
2526 const ALLOCATOR& basicAllocator)
2527: d_compAndAlloc(comparator, basicAllocator)
2530 if (first != last) {
2533 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last);
2535 if (0 < numElements) {
2536 nodeFactory().reserveNodes(numElements);
2539 BloombergLP::bslalg::RbTreeUtilTreeProctor<NodeFactory> proctor(
2550 BloombergLP::bslalg::RbTreeNode *prevNode = d_tree.rootNode();
2551 while (++first != last) {
2555 if (this->comparator()(value.
first, *prevNode)) {
2561 if (this->comparator()(*prevNode, value.
first)) {
2562 BloombergLP::bslalg::RbTreeNode *node =
2563 nodeFactory().emplaceIntoNewNode(value);
2564 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2575template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2576template <
class INPUT_ITERATOR>
2579 INPUT_ITERATOR last,
2580 const ALLOCATOR& basicAllocator)
2581: d_compAndAlloc(COMPARATOR(), basicAllocator)
2584 map other(first, last, COMPARATOR(), nodeFactory().
allocator());
2585 quickSwapRetainAllocators(other);
2588#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2589template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2592 std::initializer_list<value_type> values,
2593 const COMPARATOR& comparator,
2594 const ALLOCATOR& basicAllocator)
2595:
map(values.
begin(), values.
end(), comparator, basicAllocator)
2599template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2602 std::initializer_list<value_type> values,
2603 const ALLOCATOR& basicAllocator)
2604: map(values.
begin(), values.
end(), COMPARATOR(), basicAllocator)
2609template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2617template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2623 if (AllocatorTraits::propagate_on_container_copy_assignment::value) {
2624 map other(rhs, rhs.nodeFactory().allocator());
2625 quickSwapExchangeAllocators(other);
2629 quickSwapRetainAllocators(other);
2635template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2639 BloombergLP::bslmf::MovableRef<map> rhs)
2641 AllocatorTraits::is_always_equal::value &&
2642 std::is_nothrow_move_assignable<COMPARATOR>::value)
2647 if (nodeFactory().
allocator() == lvalue.nodeFactory().allocator()) {
2648 map other(MoveUtil::move(lvalue));
2649 quickSwapRetainAllocators(other);
2652 AllocatorTraits::propagate_on_container_move_assignment::value) {
2653 map other(MoveUtil::move(lvalue));
2654 quickSwapExchangeAllocators(other);
2657 map other(MoveUtil::move(lvalue), nodeFactory().allocator());
2658 quickSwapRetainAllocators(other);
2664#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2665template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2667map<KEY, VALUE, COMPARATOR, ALLOCATOR>&
2669 std::initializer_list<value_type> values)
2672 insert(values.begin(), values.end());
2677template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2683 if (iter ==
end() || this->comparator()(key, *iter.node())) {
2684#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2685 iter = emplace_hint(iter,
2686 std::piecewise_construct,
2687 std::forward_as_tuple(key),
2688 std::forward_as_tuple());
2690 BloombergLP::bsls::ObjectBuffer<VALUE> temp;
2692 ALLOCATOR alloc = nodeFactory().allocator();
2694 AllocatorTraits::construct(alloc, temp.address());
2696 BloombergLP::bslma::DestructorGuard<VALUE> guard(temp.address());
2698 iter = emplace_hint(iter, key, temp.object());
2701 return iter->second;
2704template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2708 BloombergLP::bslmf::MovableRef<key_type> key)
2712 iterator iter = lower_bound(lvalue);
2713 if (iter ==
end() || this->comparator()(lvalue, *iter.node())) {
2714#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2715 iter = emplace_hint(
2717 std::piecewise_construct,
2719 std::forward_as_tuple());
2721 BloombergLP::bsls::ObjectBuffer<VALUE> temp;
2723 ALLOCATOR alloc = nodeFactory().allocator();
2725 AllocatorTraits::construct(alloc, temp.address());
2727 BloombergLP::bslma::DestructorGuard<VALUE> guard(temp.address());
2729 iter = emplace_hint(iter, lvalue, temp.object());
2732 return iter->second;
2735template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2739 BloombergLP::bslalg::RbTreeNode *node =
2740 BloombergLP::bslalg::RbTreeUtil::find(d_tree, this->comparator(), key);
2741 if (d_tree.sentinel() == node) {
2742 BloombergLP::bslstl::StdExceptUtil::throwOutOfRange(
2743 "map<...>::at(key_type): invalid key value");
2745 return toNode(node)->value().second;
2748template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2753 return iterator(d_tree.firstNode());
2756template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2761 return iterator(d_tree.sentinel());
2764template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2772template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2780template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2785 int comparisonResult;
2786 BloombergLP::bslalg::RbTreeNode *insertLocation =
2787 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2792 if (!comparisonResult) {
2796 BloombergLP::bslalg::RbTreeNode *node =
2797 nodeFactory().emplaceIntoNewNode(value);
2798 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2800 comparisonResult < 0,
2805template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2809 BloombergLP::bslmf::MovableRef<value_type> value)
2813 int comparisonResult;
2814 BloombergLP::bslalg::RbTreeNode *insertLocation =
2815 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2820 if (!comparisonResult) {
2824 BloombergLP::bslalg::RbTreeNode *node =
2825 nodeFactory().emplaceIntoNewNode(MoveUtil::move(lvalue));
2826 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2828 comparisonResult < 0,
2833template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2834template <
class INPUT_ITERATOR>
2837 INPUT_ITERATOR last)
2851 const bool canCalculateInsertDistance =
2853 iterator_traits<INPUT_ITERATOR>::iterator_category,
2854 forward_iterator_tag>::value;
2856 while (first != last) {
2857 if (canCalculateInsertDistance
2859 !nodeFactory().hasFreeNodes())) {
2861 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last);
2863 nodeFactory().reserveNodes(numElements);
2870#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
2871template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2874 const_iterator last)
2876 while (first != last) {
2883template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2889 BloombergLP::bslalg::RbTreeNode *hintNode =
2890 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
2891 int comparisonResult;
2892 BloombergLP::bslalg::RbTreeNode *insertLocation =
2893 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2899 if (!comparisonResult) {
2903 BloombergLP::bslalg::RbTreeNode *node =
2904 nodeFactory().emplaceIntoNewNode(value);
2905 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2907 comparisonResult < 0,
2912template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2917 BloombergLP::bslmf::MovableRef<value_type> value)
2921 BloombergLP::bslalg::RbTreeNode *hintNode =
2922 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
2923 int comparisonResult;
2924 BloombergLP::bslalg::RbTreeNode *insertLocation =
2925 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2931 if (!comparisonResult) {
2935 BloombergLP::bslalg::RbTreeNode *node =
2936 nodeFactory().emplaceIntoNewNode(MoveUtil::move(lvalue));
2938 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2940 comparisonResult < 0,
2945#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2946template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2949 std::initializer_list<value_type> values)
2951 insert(values.begin(), values.end());
2955#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
2956template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2957template <
class BDE_OTHER_TYPE>
2959pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator,
bool>
2961 BDE_OTHER_TYPE&& obj)
2963 int comparisonResult;
2964 BloombergLP::bslalg::RbTreeNode *insertLocation =
2965 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2971 if (!comparisonResult) {
2978 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
2981 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2983 comparisonResult < 0,
2989template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
2990template <
class BDE_OTHER_TYPE>
2995 BDE_OTHER_TYPE&& obj)
2997 BloombergLP::bslalg::RbTreeNode *hintNode =
2998 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
2999 int comparisonResult;
3000 BloombergLP::bslalg::RbTreeNode *insertLocation =
3001 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3008 if (!comparisonResult) {
3015 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3018 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3020 comparisonResult < 0,
3026template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3027template <
class BDE_OTHER_TYPE>
3031 BloombergLP::bslmf::MovableRef<key_type> key,
3032 BDE_OTHER_TYPE&& obj)
3034 int comparisonResult;
3035 BloombergLP::bslalg::RbTreeNode *insertLocation =
3036 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3042 if (!comparisonResult) {
3049 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3053 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3055 comparisonResult < 0,
3061template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3062template <
class BDE_OTHER_TYPE>
3067 BloombergLP::bslmf::MovableRef<key_type> key,
3068 BDE_OTHER_TYPE&& obj)
3070 BloombergLP::bslalg::RbTreeNode *hintNode =
3071 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3072 int comparisonResult;
3073 BloombergLP::bslalg::RbTreeNode *insertLocation =
3074 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3081 if (!comparisonResult) {
3088 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3092 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3094 comparisonResult < 0,
3101#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
3103template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3104template <
class... Args>
3109 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3111 int comparisonResult;
3112 BloombergLP::bslalg::RbTreeNode *insertLocation =
3113 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3117 static_cast<const Node *
>(node)->value().first);
3118 if (!comparisonResult) {
3119 nodeFactory().deleteNode(node);
3123 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3125 comparisonResult < 0,
3130template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3131template <
class... Args>
3137 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3139 BloombergLP::bslalg::RbTreeNode *hintNode =
3140 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3141 int comparisonResult;
3142 BloombergLP::bslalg::RbTreeNode *insertLocation =
3143 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3147 static_cast<const Node *
>(node)->value().first,
3149 if (!comparisonResult) {
3150 nodeFactory().deleteNode(node);
3154 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3156 comparisonResult < 0,
3163template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3170 BloombergLP::bslalg::RbTreeNode *node =
3171 const_cast<BloombergLP::bslalg::RbTreeNode *
>(position.node());
3172 BloombergLP::bslalg::RbTreeNode *result =
3173 BloombergLP::bslalg::RbTreeUtil::next(node);
3174 BloombergLP::bslalg::RbTreeUtil::remove(&d_tree, node);
3175 nodeFactory().deleteNode(node);
3179template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3187template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3200template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3206 while (first != last) {
3207 first =
erase(first);
3212template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3216 AllocatorTraits::is_always_equal::value &&
3217 bsl::is_nothrow_swappable<COMPARATOR>::value)
3219 if (AllocatorTraits::propagate_on_container_swap::value) {
3220 quickSwapExchangeAllocators(other);
3227 nodeFactory().allocator() == other.nodeFactory().allocator())) {
3228 quickSwapRetainAllocators(other);
3233 map toOtherCopy(MoveUtil::move(*
this),
3234 other.nodeFactory().allocator());
3235 map toThisCopy(MoveUtil::move(other), nodeFactory().allocator());
3237 this->quickSwapRetainAllocators(toThisCopy);
3238 other.quickSwapRetainAllocators(toOtherCopy);
3243#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
3244template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3245template <
class... Args>
3247pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator,
bool>
3251 int comparisonResult;
3252 BloombergLP::bslalg::RbTreeNode *insertLocation =
3253 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3258 if (!comparisonResult) {
3262#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3263 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3264 std::piecewise_construct,
3265 std::forward_as_tuple(key),
3268 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3273 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3275 comparisonResult < 0,
3280template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3281template <
class... Args>
3288 BloombergLP::bslalg::RbTreeNode *hintNode =
3289 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3290 int comparisonResult;
3291 BloombergLP::bslalg::RbTreeNode *insertLocation =
3292 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3298 if (!comparisonResult) {
3302#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3303 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3304 std::piecewise_construct,
3305 std::forward_as_tuple(key),
3308 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3313 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3315 comparisonResult < 0,
3320template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3321template <
class... Args>
3325 BloombergLP::bslmf::MovableRef<key_type> key,
3330 int comparisonResult;
3331 BloombergLP::bslalg::RbTreeNode *insertLocation =
3332 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3337 if (!comparisonResult) {
3341#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3342 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3343 std::piecewise_construct,
3347 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3352 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3354 comparisonResult < 0,
3360template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3361template <
class... Args>
3366 BloombergLP::bslmf::MovableRef<key_type> key,
3371 BloombergLP::bslalg::RbTreeNode *hintNode =
3372 const_cast<BloombergLP::bslalg::RbTreeNode *
>(hint.node());
3373 int comparisonResult;
3374 BloombergLP::bslalg::RbTreeNode *insertLocation =
3375 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3381 if (!comparisonResult) {
3385#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3386 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3387 std::piecewise_construct,
3391 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
3396 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3398 comparisonResult < 0,
3404template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3410 if (d_tree.rootNode()) {
3414 BloombergLP::bslalg::RbTreeUtil::deleteTree(&d_tree, &nodeFactory());
3416#if defined(BSLS_ASSERT_SAFE_IS_USED)
3425template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3431 return nodeFactory().allocator();
3434template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3442template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3450template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3458template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3466template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3474template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3482template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3490template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3498template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3503 return find(key) !=
end();
3507template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3512 return 0 == d_tree.numNodes();
3515template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3520 return d_tree.numNodes();
3523template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3528 return AllocatorTraits::max_size(get_allocator());
3531template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3536 const BloombergLP::bslalg::RbTreeNode *node =
3537 BloombergLP::bslalg::RbTreeUtil::find(d_tree,
3540 if (d_tree.sentinel() == node) {
3541 BloombergLP::bslstl::StdExceptUtil::throwOutOfRange(
3542 "map<...>::at(key_type): invalid key value");
3544 return toNode(node)->value().second;
3547template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3552 return comparator().keyComparator();
3555template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3566template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3571 return BloombergLP::bslalg::RangeCompare::equal(lhs.
begin(),
3579#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
3580template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3585 return !(lhs == rhs);
3589#ifdef BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
3591template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3593BloombergLP::bslalg::SynthThreeWayUtil::Result<bsl::pair<const KEY, VALUE>>
3594bsl::operator<=>(
const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
3595 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs)
3597 return bsl::lexicographical_compare_three_way(
3602 BloombergLP::bslalg::SynthThreeWayUtil::compare);
3607template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3612 return 0 > BloombergLP::bslalg::RangeCompare::lexicographical(lhs.
begin(),
3620template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3628template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3633 return !(rhs < lhs);
3636template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3641 return !(lhs < rhs);
3654bsl::erase_if(map<KEY, VALUE, COMPARATOR, ALLOCATOR>& m, PREDICATE predicate)
3656 return BloombergLP::bslstl::AlgorithmUtil::containerEraseIf(m, predicate);
3659template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3681template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
3691template <
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
Definition bslma_bslallocator.h:580
Definition bslstl_string.h:1281
Definition bslstl_map.h:736
value_compare(const value_compare &original)=default
value_type second_argument_type
Definition bslstl_map.h:768
COMPARATOR comp
Definition bslstl_map.h:743
bool operator()(const value_type &x, const value_type &y) const
Definition bslstl_map.h:2337
value_type first_argument_type
Definition bslstl_map.h:763
value_compare & operator=(const value_compare &rhs)=default
bool result_type
Definition bslstl_map.h:758
Definition bslstl_map.h:619
value_type & reference
Definition bslstl_map.h:713
iterator erase(const_iterator position)
Definition bslstl_map.h:3166
allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3428
enable_if< is_convertible< ALT_VALUE_TYPE, value_type >::value, iterator >::type insert(const_iterator hint, BSLS_COMPILERFEATURES_FORWARD_REF(ALT_VALUE_TYPE) value)
Definition bslstl_map.h:1207
const_reverse_iterator crend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3493
void insert(INPUT_ITERATOR first, INPUT_ITERATOR last)
Definition bslstl_map.h:2836
map &operator=(BloombergLP::bslmf::MovableRef< map > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits add_lvalue_reference< VALUE >::type operator[](const key_type &key)
Definition bslstl_map.h:2680
bool contains(const key_type &key) const
Definition bslstl_map.h:3500
BloombergLP::bslstl::TreeIterator< const value_type, Node, difference_type > const_iterator
Definition bslstl_map.h:724
reverse_iterator rend() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:2775
pair< iterator, iterator > equal_range(const key_type &key)
Definition bslstl_map.h:1651
iterator erase(const_iterator first, const_iterator last)
Definition bslstl_map.h:3203
iterator upper_bound(const key_type &key)
Definition bslstl_map.h:1612
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, const_iterator >::type lower_bound(const LOOKUP_KEY &key) const
Definition bslstl_map.h:1900
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:2759
iterator try_emplace(const_iterator hint, const KEY &key, Args &&... args)
Definition bslstl_map.h:3284
map()
Definition bslstl_map.h:2438
~map()
Destroy this object.
Definition bslstl_map.h:2611
const_reverse_iterator crbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3485
size_type erase(const key_type &key)
Definition bslstl_map.h:3190
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, iterator >::type find(const LOOKUP_KEY &key)
Definition bslstl_map.h:1559
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value &&!bsl::is_convertible< LOOKUP_KEY &&, const_iterator >::value &&!bsl::is_convertible< LOOKUP_KEY &&, iterator >::value, pair< iterator, bool > >::type try_emplace(LOOKUP_KEY &&key, Args &&... args)
Definition bslstl_map.h:1427
reverse_iterator rbegin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:2767
iterator lower_bound(const key_type &key)
Definition bslstl_map.h:1575
size_type count(const key_type &key) const
Definition bslstl_map.h:1839
const value_type & const_reference
Definition bslstl_map.h:714
KEY key_type
Definition bslstl_map.h:708
pair< iterator, bool > insert_or_assign(BloombergLP::bslmf::MovableRef< KEY > key, BDE_OTHER_TYPE &&obj)
map(const ALLOCATOR &basicAllocator)
Definition bslstl_map.h:2446
iterator insert(const_iterator hint, BloombergLP::bslmf::MovableRef< value_type > value)
Definition bslstl_map.h:2915
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, iterator >::type lower_bound(const LOOKUP_KEY &key)
Definition bslstl_map.h:1596
AllocatorTraits::const_pointer const_pointer
Definition bslstl_map.h:719
add_lvalue_reference< VALUE >::type at(const key_type &key)
Definition bslstl_map.h:2737
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, pair< iterator, iterator > >::type equal_range(const LOOKUP_KEY &key)
Definition bslstl_map.h:1681
iterator insert_or_assign(const_iterator hint, const KEY &key, BDE_OTHER_TYPE &&obj)
Definition bslstl_map.h:2993
pair< iterator, bool > emplace(Args &&... args)
map(BloombergLP::bslmf::MovableRef< map > original, const typename type_identity< ALLOCATOR >::type &basicAllocator)
Definition bslstl_map.h:2496
map(const map &original, const typename type_identity< ALLOCATOR >::type &basicAllocator)
Definition bslstl_map.h:2481
bsl::reverse_iterator< iterator > reverse_iterator
Definition bslstl_map.h:725
iterator find(const key_type &key)
Definition bslstl_map.h:1542
void swap(map &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits pair< iterator, bool > try_emplace(const KEY &key, Args &&... args)
Definition bslstl_map.h:1416
ALLOCATOR allocator_type
Definition bslstl_map.h:712
map & operator=(const map &rhs)
Definition bslstl_map.h:2620
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, const_iterator >::type find(const LOOKUP_KEY &key) const
Definition bslstl_map.h:1828
bool empty() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3509
pair< iterator, bool > insert_or_assign(const KEY &key, BDE_OTHER_TYPE &&obj)
iterator erase(iterator position)
Definition bslstl_map.h:3182
size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the number of elements in this map.
Definition bslstl_map.h:3518
map(BloombergLP::bslmf::MovableRef< map > original)
Definition bslstl_map.h:2470
pair< iterator, bool > insert(const value_type &value)
Definition bslstl_map.h:2783
iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:2751
VALUE mapped_type
Definition bslstl_map.h:709
map(const COMPARATOR &comparator, const ALLOCATOR &basicAllocator=ALLOCATOR())
Definition bslstl_map.h:855
pair< const_iterator, const_iterator > equal_range(const key_type &key) const
Definition bslstl_map.h:1957
void clear() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3406
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, size_type >::type count(const LOOKUP_KEY &key) const
Definition bslstl_map.h:1857
pair< iterator, bool > try_emplace(BloombergLP::bslmf::MovableRef< KEY > key, Args &&... args)
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, iterator >::type try_emplace(const_iterator hint, LOOKUP_KEY &&key, Args &&... args)
Definition bslstl_map.h:1486
add_lvalue_reference< VALUE >::type operator[](BloombergLP::bslmf::MovableRef< key_type > key)
Definition bslstl_map.h:2707
value_compare value_comp() const
Definition bslstl_map.h:3558
const_iterator cbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3469
size_type max_size() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3526
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, iterator >::type upper_bound(const LOOKUP_KEY &key)
Definition bslstl_map.h:1633
iterator insert_or_assign(const_iterator hint, BloombergLP::bslmf::MovableRef< KEY > key, BDE_OTHER_TYPE &&obj)
Definition bslstl_map.h:3065
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, pair< const_iterator, const_iterator > >::type equal_range(const LOOKUP_KEY &key) const
Definition bslstl_map.h:1987
map(INPUT_ITERATOR first, INPUT_ITERATOR last, const COMPARATOR &comparator=COMPARATOR(), const ALLOCATOR &basicAllocator=ALLOCATOR())
Definition bslstl_map.h:2523
bsl::reverse_iterator< const_iterator > const_reverse_iterator
Definition bslstl_map.h:726
enable_if< is_convertible< ALT_VALUE_TYPE, value_type >::value, pair< iterator, bool > >::type insert(BSLS_COMPILERFEATURES_FORWARD_REF(ALT_VALUE_TYPE) value)
Definition bslstl_map.h:1135
AllocatorTraits::size_type size_type
Definition bslstl_map.h:716
iterator emplace_hint(const_iterator hint, Args &&... args)
Definition bslstl_map.h:3134
const_iterator cend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3477
BloombergLP::bslstl::TreeIterator< value_type, Node, difference_type > iterator
Definition bslstl_map.h:722
pair< const KEY, VALUE > value_type
Definition bslstl_map.h:710
iterator insert(const_iterator hint, const value_type &value)
Definition bslstl_map.h:2886
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< COMPARATOR, LOOKUP_KEY >::value, const_iterator >::type upper_bound(const LOOKUP_KEY &key) const
Definition bslstl_map.h:1939
AllocatorTraits::pointer pointer
Definition bslstl_map.h:718
AllocatorTraits::difference_type difference_type
Definition bslstl_map.h:717
key_compare key_comp() const
Definition bslstl_map.h:3550
const_iterator upper_bound(const key_type &key) const
Definition bslstl_map.h:1918
map(INPUT_ITERATOR first, INPUT_ITERATOR last, const ALLOCATOR &basicAllocator)
Definition bslstl_map.h:2578
map(const map &original)
Definition bslstl_map.h:2454
iterator try_emplace(const_iterator hint, BloombergLP::bslmf::MovableRef< KEY > key, Args &&... args)
Definition bslstl_map.h:3364
const_iterator lower_bound(const key_type &key) const
Definition bslstl_map.h:1879
COMPARATOR key_compare
Definition bslstl_map.h:711
Definition bslstl_pair.h:1210
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2012
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:632
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:634
Definition bdlb_printmethods.h:283
void swap(array< VALUE_TYPE, SIZE > &lhs, array< VALUE_TYPE, SIZE > &rhs)
T::const_iterator cend(const T &container)
Definition bslstl_iterator.h:1611
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:1597
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)
deque< VALUE_TYPE, ALLOCATOR >::size_type erase(deque< VALUE_TYPE, ALLOCATOR > &deq, const BDE_OTHER_TYPE &value)
Definition bslstl_deque.h:4126
T::iterator begin(T &container)
Definition bslstl_iterator.h:1495
T::const_iterator cbegin(const T &container)
Definition bslstl_iterator.h:1553
T::iterator end(T &container)
Definition bslstl_iterator.h:1523
deque< VALUE_TYPE, ALLOCATOR >::size_type erase_if(deque< VALUE_TYPE, ALLOCATOR > &deq, PREDICATE predicate)
Definition bslstl_deque.h:4135
bool operator!=(const memory_resource &a, const memory_resource &b)
T::const_reverse_iterator crend(const T &container)
Definition bslstl_iterator.h:1654
Definition bdlc_flathashmap.h:1805
Definition balxml_encoderoptions.h:68
Definition bdlbb_blob.h:576
TYPE first
Definition bslstl_pair.h:605
Definition bslmf_addlvaluereference.h:126
t_TYPE & type
This typedef defines the return type of this meta function.
Definition bslmf_addlvaluereference.h:129
Definition bslma_allocatortraits.h:1061
BloombergLP::bslma::AllocatorTraits_ConstPointerType< ALLOCATOR >::type const_pointer
Definition bslma_allocatortraits.h:1152
BloombergLP::bslma::AllocatorTraits_SizeType< ALLOCATOR >::type size_type
Definition bslma_allocatortraits.h:1165
BloombergLP::bslma::AllocatorTraits_PointerType< ALLOCATOR >::type pointer
Definition bslma_allocatortraits.h:1149
BloombergLP::bslma::AllocatorTraits_DifferenceType< ALLOCATOR >::type difference_type
Definition bslma_allocatortraits.h:1162
Definition bslmf_enableif.h:525
Definition bslmf_isconvertible.h:867
t_TYPE type
Definition bslmf_typeidentity.h:216
Definition bslalg_hasstliterators.h:99
Definition bslma_usesbslmaallocator.h:343