Go to the documentation of this file.
15 #ifndef ABSL_CONTAINER_INTERNAL_BTREE_CONTAINER_H_
16 #define ABSL_CONTAINER_INTERNAL_BTREE_CONTAINER_H_
19 #include <initializer_list>
23 #include "absl/base/attributes.h"
24 #include "absl/base/internal/throw_delegate.h"
25 #include "absl/container/internal/btree.h"
26 #include "absl/container/internal/common.h"
27 #include "absl/memory/memory.h"
28 #include "absl/meta/type_traits.h"
32 namespace container_internal {
36 template <
typename Tree>
78 select_on_container_copy_construction(
107 template <
typename K = key_type>
112 template <
typename K = key_type>
116 template <
typename K = key_type>
120 template <
typename K = key_type>
124 template <
typename K = key_type>
128 template <
typename K = key_type>
132 template <
typename K = key_type>
136 template <
typename K = key_type>
140 template <
typename K = key_type>
144 template <
typename K = key_type>
161 template <
typename K = key_type>
191 if (
x.size() !=
y.size())
return false;
192 return std::equal(
x.begin(),
x.end(),
y.begin());
200 return std::lexicographical_compare(
x.begin(),
x.end(),
y.begin(),
y.end());
223 template <
typename State>
225 for (
const auto &
v :
b) {
228 return State::combine(
std::move(h),
b.size());
237 template <
typename Tree>
261 using super_type::super_type;
265 template <
class InputIterator>
272 template <
class InputIterator>
293 template <
typename...
Args>
296 auto node = CommonAccess::Construct<node_type>(this->
get_allocator(),
297 std::forward<Args>(
args)...);
311 template <
typename...
Args>
314 auto node = CommonAccess::Construct<node_type>(this->
get_allocator(),
315 std::forward<Args>(
args)...);
321 template <
typename InputIterator>
322 void insert(InputIterator
b, InputIterator e) {
323 this->
tree_.insert_iterator_unique(b,
e, 0);
326 this->
tree_.insert_iterator_unique(init.begin(),
init.end(), 0);
330 std::pair<iterator, bool> res =
337 return {res.first,
false,
std::move(node)};
341 if (!node)
return this->
end();
342 std::pair<iterator, bool> res = this->
tree_.insert_hint_unique(
350 template <
typename K = key_type>
352 const std::pair<iterator, bool> lower_and_equal =
353 this->
tree_.lower_bound_equal(key);
354 return lower_and_equal.second ?
extract(lower_and_equal.first)
366 std::is_same<value_type, typename T::value_type>,
367 std::is_same<allocator_type, typename T::allocator_type>,
368 std::is_same<
typename params_type::is_map_container,
369 typename T::params_type::is_map_container>>
::value,
372 for (
auto src_it = src.
begin(); src_it != src.
end();) {
374 src_it = src.
erase(src_it);
385 std::is_same<value_type, typename T::value_type>,
386 std::is_same<allocator_type, typename T::allocator_type>,
387 std::is_same<
typename params_type::is_map_container,
388 typename T::params_type::is_map_container>>
::value,
396 template <
typename Tree>
422 template <
typename K = key_type,
class M>
427 template <
typename K = key_type,
class M, K * =
nullptr>
431 template <
typename K = key_type,
class M, M * =
nullptr>
435 template <
typename K = key_type,
class M, K * =
nullptr, M * =
nullptr>
439 template <
typename K = key_type,
class M>
444 template <
typename K = key_type,
class M, K * =
nullptr>
448 template <
typename K = key_type,
class M, M * =
nullptr>
452 template <
typename K = key_type,
class M, K * =
nullptr, M * =
nullptr>
455 std::forward<M>(
obj));
478 std::forward<Args>(
args)...);
481 template <
typename K = key_type>
485 template <
typename K = key_type>
490 template <
typename K = key_type>
492 auto it = this->
find(key);
493 if (
it == this->
end())
497 template <
typename K = key_type>
499 auto it = this->
find(key);
500 if (
it == this->
end())
509 template <
class K,
class M>
511 const std::pair<iterator, bool>
ret =
512 this->
tree_.insert_unique(
k, std::forward<K>(
k), std::forward<M>(
obj));
513 if (!
ret.second)
ret.first->second = std::forward<M>(
obj);
516 template <
class K,
class M>
518 const std::pair<iterator, bool>
ret = this->
tree_.insert_hint_unique(
519 iterator(hint),
k, std::forward<K>(
k), std::forward<M>(
obj));
520 if (!
ret.second)
ret.first->second = std::forward<M>(
obj);
524 template <
class K,
class...
Args>
526 return this->
tree_.insert_unique(
527 k, std::piecewise_construct, std::forward_as_tuple(std::forward<K>(
k)),
528 std::forward_as_tuple(std::forward<Args>(
args)...));
530 template <
class K,
class...
Args>
533 .insert_hint_unique(
iterator(hint),
k, std::piecewise_construct,
534 std::forward_as_tuple(std::forward<K>(
k)),
535 std::forward_as_tuple(std::forward<Args>(
args)...))
541 template <
typename Tree>
563 using super_type::super_type;
567 template <
class InputIterator>
574 template <
class InputIterator>
599 template <
typename InputIterator>
600 void insert(InputIterator
b, InputIterator e) {
601 this->
tree_.insert_iterator_multi(b,
e);
604 this->
tree_.insert_iterator_multi(init.begin(),
init.end());
606 template <
typename...
Args>
609 auto node = CommonAccess::Construct<node_type>(this->
get_allocator(),
610 std::forward<Args>(
args)...);
613 template <
typename...
Args>
616 auto node = CommonAccess::Construct<node_type>(this->
get_allocator(),
617 std::forward<Args>(
args)...);
622 if (!node)
return this->
end();
630 if (!node)
return this->
end();
639 template <
typename K = key_type>
641 const std::pair<iterator, bool> lower_and_equal =
642 this->
tree_.lower_bound_equal(key);
643 return lower_and_equal.second ?
extract(lower_and_equal.first)
654 std::is_same<value_type, typename T::value_type>,
655 std::is_same<allocator_type, typename T::allocator_type>,
656 std::is_same<
typename params_type::is_map_container,
657 typename T::params_type::is_map_container>>
::value,
660 for (
auto src_it = src.
begin(),
end = src.
end(); src_it !=
end; ++src_it) {
670 std::is_same<value_type, typename T::value_type>,
671 std::is_same<allocator_type, typename T::allocator_type>,
672 std::is_same<
typename params_type::is_map_container,
673 typename T::params_type::is_map_container>>
::value,
681 template <
typename Tree>
699 #endif // ABSL_CONTAINER_INTERNAL_BTREE_CONTAINER_H_
typename super_type::node_type node_type
void insert(std::initializer_list< init_type > init)
btree_set_container(InputIterator b, InputIterator e, const key_compare &comp=key_compare(), const allocator_type &alloc=allocator_type())
OPENSSL_EXPORT const ASN1_OBJECT * obj
std::pair< iterator, bool > insert_or_assign(const key_arg< K > &k, const M &obj)
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::const_reference const_reference
std::pair< iterator, bool > insert_or_assign_impl(K &&k, M &&obj)
const_iterator cend() const
btree_multiset_container(InputIterator b, InputIterator e, const allocator_type &alloc)
bool contains(const key_arg< K > &key) const
typename Tree::iterator iterator
static std::function< Slot &(Slot *)> element
void insert(std::initializer_list< init_type > init)
iterator insert(const_iterator hint, const value_type &v)
typename Tree::iterator iterator
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::reverse_iterator reverse_iterator
std::pair< iterator, bool > emplace(Args &&... args)
btree_set_container(std::initializer_list< init_type > init, const allocator_type &alloc)
typename Tree::allocator_type allocator_type
iterator try_emplace(const_iterator hint, key_arg< K > &&k, Args &&... args)
static void Destroy(Node *node)
key_compare key_comp() const
btree_set_container(InputIterator b, InputIterator e, const allocator_type &alloc)
iterator emplace(Args &&... args)
iterator erase(iterator iter)
node_type extract(const key_arg< K > &key)
typename Tree::key_type key_type
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::original_key_compare key_compare
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::node_handle_type node_type
iterator erase(const_iterator first, const_iterator last)
void merge(btree_container< T > &&src)
btree_container< Tree > super_type
typename Tree::allocator_type allocator_type
typename std::enable_if< B, T >::type enable_if_t
typename Tree::original_key_compare key_compare
ABSL_ATTRIBUTE_REINITIALIZES void clear()
reverse_iterator rbegin()
btree_container(const btree_container &other, const allocator_type &alloc)
#define ABSL_NAMESPACE_END
const typedef MCPhysReg * iterator
const_reverse_iterator rbegin() const
#define T(upbtypeconst, upbtype, ctype, default_value)
iterator insert(const value_type &v)
typename params_type::mapped_type mapped_type
btree_multiset_container()
btree_container & operator=(const btree_container &other)=default
btree_multimap_container()
friend State AbslHashValue(State h, const btree_container &b)
typename params_type::init_type init_type
typename params_type::is_key_compare_to is_key_compare_to
void ThrowStdOutOfRange(const std::string &what_arg)
iterator erase(const_iterator iter)
static auto GetSlot(const Node &node) -> decltype(node.slot())
iterator lower_bound(const key_arg< K > &key)
const mapped_type & at(const key_arg< K > &key) const
#define ABSL_NAMESPACE_BEGIN
typename Tree::original_key_compare key_compare
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::value_type value_type
void merge(btree_container< T > &&src)
std::pair< iterator, bool > try_emplace_impl(K &&k, Args &&... args)
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
std::pair< iterator, bool > insert(value_type &&v)
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::const_reverse_iterator const_reverse_iterator
iterator find(const key_arg< K > &key)
iterator insert(node_type &&node)
const_reverse_iterator crbegin() const
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::allocator_type allocator_type
iterator insert_or_assign(const_iterator hint, key_arg< K > &&k, M &&obj)
void insert(InputIterator b, InputIterator e)
typename params_type::is_key_compare_to is_key_compare_to
btree_multiset_container(std::initializer_list< init_type > init, const allocator_type &alloc)
mapped_type & operator[](const key_arg< K > &k)
btree_multiset_container(InputIterator b, InputIterator e, const key_compare &comp=key_compare(), const allocator_type &alloc=allocator_type())
btree_multiset_container(std::initializer_list< init_type > init, const key_compare &comp=key_compare(), const allocator_type &alloc=allocator_type())
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::params_type params_type
std::pair< iterator, bool > insert_or_assign(key_arg< K > &&k, M &&obj)
btree_set_container(std::initializer_list< init_type > init, const key_compare &comp=key_compare(), const allocator_type &alloc=allocator_type())
const_iterator find(const key_arg< K > &key) const
friend bool operator<(const btree_container &x, const btree_container &y)
const_iterator begin() const
size_type count(const key_arg< K > &key) const
std::pair< iterator, bool > insert_or_assign(key_arg< K > &&k, const M &obj)
mapped_type & operator[](key_arg< K > &&k)
friend bool operator!=(const btree_container &x, const btree_container &y)
const_iterator lower_bound(const key_arg< K > &key) const
typename super_type::node_type node_type
void merge(btree_container< T > &src)
friend bool operator==(const btree_container &x, const btree_container &y)
const_iterator upper_bound(const key_arg< K > &key) const
friend bool operator>=(const btree_container &x, const btree_container &y)
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::key_type key_type
iterator insert_or_assign(const_iterator hint, key_arg< K > &&k, const M &obj)
std::pair< iterator, bool > insert_or_assign(const key_arg< K > &k, M &&obj)
std::pair< iterator, bool > try_emplace(const key_arg< K > &k, Args &&... args)
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::pointer pointer
std::pair< iterator, bool > try_emplace(key_arg< K > &&k, Args &&... args)
size_type max_size() const
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::iterator iterator
void merge(btree_container< T > &src)
iterator upper_bound(const key_arg< K > &key)
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::difference_type difference_type
iterator insert(const_iterator hint, value_type &&v)
iterator try_emplace_hint_impl(const_iterator hint, K &&k, Args &&... args)
iterator insert(const_iterator hint, value_type &&v)
btree_container(btree_container &&other, const allocator_type &alloc)
iterator insert(const_iterator hint, node_type &&node)
iterator insert_or_assign(const_iterator hint, const key_arg< K > &k, M &&obj)
const_reverse_iterator rend() const
typename KeyArg< params_type::kIsKeyCompareTransparent >::template type< K, typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::key_type > key_arg
UniquePtr< SSL_SESSION > ret
node_type extract(iterator position)
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::const_iterator const_iterator
iterator try_emplace(const_iterator hint, const key_arg< K > &k, Args &&... args)
btree_container< Tree > super_type
iterator insert_or_assign_hint_impl(const_iterator hint, K &&k, M &&obj)
void swap(btree_container &other)
std::pair< iterator, bool > insert(const value_type &v)
iterator emplace_hint(const_iterator hint, Args &&... args)
btree_container(const key_compare &comp, const allocator_type &alloc=allocator_type())
const_iterator end() const
friend bool operator<=(const btree_container &x, const btree_container &y)
node_type extract(const key_arg< K > &key)
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::const_pointer const_pointer
typename params_type::mapped_type mapped_type
allocator_type get_allocator() const
#define ABSL_ATTRIBUTE_REINITIALIZES
iterator insert(const_iterator hint, const value_type &v)
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::reference reference
const_reverse_iterator crend() const
typename params_type::init_type init_type
std::pair< const_iterator, const_iterator > equal_range(const key_arg< K > &key) const
std::pair< iterator, iterator > equal_range(const key_arg< K > &key)
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::value_compare value_compare
friend bool operator>(const btree_container &x, const btree_container &y)
iterator insert(value_type &&v)
btree_container(const btree_container &other)
void insert(InputIterator b, InputIterator e)
const typedef T & const_reference
typename Tree::iterator iterator
iterator insert_or_assign(const_iterator hint, const key_arg< K > &k, const M &obj)
mapped_type & at(const key_arg< K > &key)
value_compare value_comp() const
iterator emplace_hint(const_iterator hint, Args &&... args)
iterator insert(const_iterator hint, node_type &&node)
std::allocator< int > alloc
typename container_internal::btree< container_internal::set_params< Key, std::less< Key >, std::allocator< Key >, 256, true > > ::size_type size_type
insert_return_type insert(node_type &&node)
size_type erase(const key_arg< K > &key)
const typedef T * const_pointer
btree_container(const allocator_type &alloc)
const_iterator cbegin() const
grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:50