Go to the documentation of this file.
33 template<
class KEY,
class VALUE>
89 size_t hl =
l.height(), hr = r.
height();
91 const BTree& ll =
l.left(), lr =
l.right();
92 if (ll.
height() >= lr.height())
95 BTree _left(ll,
l.keyValue(), lr.left());
96 BTree _right(lr.right(), xd, r);
99 }
else if (hr > hl + 2) {
101 if (rr.height() >= rl.
height())
147 const KEY&
x = xd.first;
158 return add(std::make_pair(
x,
d));
163 if (!
root_)
return false;
164 if (
x ==
key())
return true;
195 if (!
root_)
throw std::invalid_argument(
"BTree::min: empty tree");
202 if (!
root_)
throw std::invalid_argument(
"BTree::remove_min: empty tree");
209 if (t1.
empty())
return t2;
210 if (t2.
empty())
return t1;
228 return (
root_ !=
nullptr) ?
root_->height_ : 0;
233 if (!
root_)
return 0;
244 const KEY&
key = node->key();
245 if (k <
key) node = node->left.root_.get();
246 else if (
key < k) node = node->right.root_.get();
247 else return node->value();
250 throw std::invalid_argument(
"BTree::find: key not found");
254 void print(
const std::string&
s =
"")
const {
257 std::stringstream
ss;
259 k.print(
s +
ss.str() +
" ");
288 const ACC&
a)
const {
310 return path_.top().first;
314 return path_.top().second;
322 if (
path_.empty())
return;
330 path_.top().second =
true;
333 path_.push(std::make_pair(
t,
false));
356 path_.push(std::make_pair(
t,
false));
373 if (
path_.empty())
throw std::invalid_argument(
374 "operator*: tried to dereference end");
380 if (
path_.empty())
throw std::invalid_argument(
381 "operator->: tried to dereference end");
382 return &(
current()->keyValue_);
406 return const_iterator(
root_);
410 const_iterator
end()
const {
411 return const_iterator();
bool operator!=(const BTree &other) const
Node(const value_type &keyValue)
ACC fold(std::function< ACC(const KEY &, const VALUE &, const ACC &)> f, const ACC &a) const
static BTree balance(const BTree &l, const value_type &xd, const BTree &r)
std::pair< sharedNode, bool > flagged
static const double d[K][N]
bool operator==(const BTree &other) const
ptrdiff_t difference_type
const sharedNode & current() const
const BTree & right() const
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
const_iterator begin() const
bool same(const BTree &other) const
BTree & operator=(const BTree &other)
const value_type keyValue_
bool operator!=(const Self &__x) const
static std::stringstream ss
BTree(const value_type &keyValue)
BTree remove(const KEY &x) const
BTree add(const value_type &xd) const
const VALUE & find(const KEY &k) const
const_iterator(const sharedNode &root)
const VALUE & value() const
bool operator==(const Self &__x) const
std::pair< KEY, VALUE > value_type
Const iterator Not trivial: iterator keeps a stack to indicate current path from root_.
Node(const BTree &l, const value_type &keyValue, const BTree &r)
BTree< KEY, TO > map(std::function< TO(const KEY &, const VALUE &)> f) const
static const Line3 l(Rot3(), 1, 1)
BTree(const BTree &other)
std::shared_ptr< const Node > sharedNode
const value_type & keyValue() const
const value_type & min() const
reference operator*() const
const typedef value_type * pointer
std::stack< flagged > path_
void iter(std::function< void(const KEY &, const VALUE &)> f) const
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
BTree(const BTree &l, const value_type &keyValue, const BTree &r)
std::pair< KEY, VALUE > value_type
const typedef value_type & reference
void print(const std::string &s="") const
const_iterator end() const
const VALUE & value() const
const BTree & left() const
std::forward_iterator_tag iterator_category
static sharedNode Node(Key key, const SymbolicFactorGraph &factors, const ChildNodes::Result &children)
pointer operator->() const
BTree add(const KEY &x, const VALUE &d) const
static BTree merge(const BTree &t1, const BTree &t2)
bool mem(const KEY &x) const
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:01:56