36 #ifndef UTIL_BTREE_BTREE_SET_H__
37 #define UTIL_BTREE_BTREE_SET_H__
48 template <
typename Key,
typename Compare = std::less<Key>, u
int16_t EntriesPerNode = 32,
49 typename Alloc = Bentley::BentleyAllocator<Key> >
50 class bset :
public btree_unique_container<
51 btree<btree_set_params<Key, Compare, Alloc, EntriesPerNode*sizeof(Key)> > > {
53 enum { TargetNodeSize = EntriesPerNode*
sizeof(Key)};
54 typedef bset<Key, Compare, EntriesPerNode, Alloc> self_type;
55 typedef btree_set_params<Key, Compare, Alloc, TargetNodeSize> params_type;
56 typedef btree<params_type> btree_type;
57 typedef btree_unique_container<btree_type> super_type;
60 typedef typename btree_type::key_compare key_compare;
61 typedef typename btree_type::allocator_type allocator_type;
65 bset(
const key_compare &comp = key_compare(),
66 const allocator_type &alloc = allocator_type())
67 : super_type(comp, alloc) {
71 bset(
const self_type &x)
76 template <
class InputIterator>
77 bset(InputIterator b, InputIterator e,
78 const key_compare &comp = key_compare(),
79 const allocator_type &alloc = allocator_type())
80 : super_type(b, e, comp, alloc) {
83 bool operator== (self_type
const& __y)
const {
return this->
size() == __y.size() && equal (this->
begin(), this->
end(), __y.begin());}
84 bool operator< (self_type
const& __y)
const {
return lexicographical_compare (this->
begin(), this->
end(), __y.begin(), __y.end());}
85 bool operator!= (self_type
const& __y)
const {
return !(*
this == __y);}
86 bool operator> (self_type
const& __y)
const {
return (__y < *
this);}
87 bool operator>= (self_type
const& __y)
const {
return !(*
this < __y);}
88 bool operator<= (self_type
const& __y)
const {
return !(__y < *
this);}
91 template <
typename K,
typename C,
int N,
typename A>
92 inline void swap(bset<K, C, N, A> &x,
93 bset<K, C, N, A> &y) {
98 template <
typename Key,
typename Compare = std::less<Key>, u
int16_t EntriesPerNode = 32,
99 typename Alloc = Bentley::BentleyAllocator<Key> >
100 class bmultiset :
public btree_multi_container<
101 btree<btree_set_params<Key, Compare, Alloc, EntriesPerNode*sizeof(Key)> > > {
103 enum { TargetNodeSize = EntriesPerNode*
sizeof(Key)};
104 typedef bmultiset<Key, Compare, EntriesPerNode, Alloc> self_type;
105 typedef btree_set_params<Key, Compare, Alloc, TargetNodeSize> params_type;
106 typedef btree<params_type> btree_type;
107 typedef btree_multi_container<btree_type> super_type;
110 typedef typename btree_type::key_compare key_compare;
111 typedef typename btree_type::allocator_type allocator_type;
115 bmultiset(
const key_compare &comp = key_compare(),
116 const allocator_type &alloc = allocator_type())
117 : super_type(comp, alloc) {
121 bmultiset(
const self_type &x)
126 template <
class InputIterator>
127 bmultiset(InputIterator b, InputIterator e,
128 const key_compare &comp = key_compare(),
129 const allocator_type &alloc = allocator_type())
130 : super_type(b, e, comp, alloc) {
133 bool operator== (self_type
const& __y)
const {
return this->
size() == __y.size() && equal (this->
begin(), this->
end(), __y.begin());}
134 bool operator< (self_type
const& __y)
const {
return lexicographical_compare (this->
begin(), this->
end(), __y.begin(), __y.end());}
135 bool operator!= (self_type
const& __y)
const {
return !(*
this == __y);}
136 bool operator> (self_type
const& __y)
const {
return (__y < *
this);}
137 bool operator>= (self_type
const& __y)
const {
return !(*
this < __y);}
138 bool operator<= (self_type
const& __y)
const {
return !(__y < *
this);}
141 template <
typename K,
typename C,
int N,
typename A>
142 inline void swap(bmultiset<K, C, N, A> &x,
143 bmultiset<K, C, N, A> &y) {
149 #endif // UTIL_BTREE_BTREE_SET_H__
150
bool operator<=(const basic_string< _CharT, _Traits, _Allocator > &__lhs, const basic_string< _CharT, _Traits, _Allocator > &__rhs)
Definition: basic_string.h:1376
iterator begin()
Definition: stdcxx/bstdmap.h:178
iterator end()
Definition: stdcxx/bstdmap.h:186
void swap(basic_string< _CharT, _Traits, _Allocator > &__a, basic_string< _CharT, _Traits, _Allocator > &__b)
Definition: basic_string.h:1396
#define BEGIN_BENTLEY_NAMESPACE
Definition: Bentley.r.h:24
bool operator<(const basic_string< _CharT, _Traits, _Allocator > &__lhs, const basic_string< _CharT, _Traits, _Allocator > &__rhs)
Definition: basic_string.h:1326
bool operator>(const basic_string< _CharT, _Traits, _Allocator > &__lhs, const basic_string< _CharT, _Traits, _Allocator > &__rhs)
Definition: basic_string.h:1366
bool operator!=(const BentleyAllocator< _Ty > &, const BentleyAllocator< _Other > &)
Definition: BentleyAllocator.h:152
bool operator>=(const basic_string< _CharT, _Traits, _Allocator > &__lhs, const basic_string< _CharT, _Traits, _Allocator > &__rhs)
Definition: basic_string.h:1386
#define END_BENTLEY_NAMESPACE
Definition: Bentley.r.h:25
size_type size() const
Definition: stdcxx/bstdmap.h:214
bool operator==(const BentleyAllocator< _Ty > &, const BentleyAllocator< _Other > &)
Definition: BentleyAllocator.h:146
Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.