31#ifndef ETL_INTRUSIVE_AVL_TREE_INCLUDED
32#define ETL_INTRUSIVE_AVL_TREE_INCLUDED
50 class intrusive_avl_tree_exception :
public exception
54 intrusive_avl_tree_exception(
const string_type reason_,
const string_type file_name_,
const numeric_type line_number_)
55 :
exception(reason_, file_name_, line_number_)
64 class intrusive_avl_tree_iterator_exception :
public intrusive_avl_tree_exception
68 intrusive_avl_tree_iterator_exception(
const string_type file_name_,
const numeric_type line_number_)
69 : intrusive_avl_tree_exception(ETL_ERROR_TEXT(
"intrusive_avl_tree:iterator", ETL_INTRUSIVE_AVL_TREE_FILE_ID
"A"), file_name_, line_number_)
78 class intrusive_avl_tree_value_is_already_linked :
public intrusive_avl_tree_exception
82 intrusive_avl_tree_value_is_already_linked(
const string_type file_name_,
const numeric_type line_number_)
83 : intrusive_avl_tree_exception(ETL_ERROR_TEXT(
"intrusive_avl_tree:value is already linked", ETL_INTRUSIVE_AVL_TREE_FILE_ID
"B"), file_name_,
125 link_type() ETL_NOEXCEPT
142 link_type(link_type&& other) ETL_NOEXCEPT
163 link_type& operator=(link_type&& other) ETL_NOEXCEPT
178 link_type(
const link_type&) =
delete;
179 link_type& operator=(
const link_type&) =
delete;
219 bool is_linked()
const
221 return base::is_linked();
225 bool is_origin()
const
227 return ETL_NULLPTR == base::etl_parent;
232 link_type* get_parent()
234 return static_cast<link_type*
>(base::etl_parent);
239 const link_type* get_parent()
const
241 return static_cast<const link_type*
>(base::etl_parent);
245 bool is_child(
const bool is_right)
const
247 const link_type* parent = get_parent();
248 return (ETL_NULLPTR != parent) && (
this == parent->get_child(is_right));
252 bool is_left_child()
const
254 return is_child(
false);
258 bool is_right_child()
const
260 return is_child(
true);
264 link_type* get_child(
const bool is_right)
266 return static_cast<link_type*
>(is_right ? base::etl_right : base::etl_left);
270 const link_type* get_child(
const bool is_right)
const
272 return static_cast<const link_type*
>(is_right ? base::etl_right : base::etl_left);
275 void set_child(link_type*
const child,
const bool is_right)
277 base*& child_ref = is_right ? base::etl_right : base::etl_left;
282 link_type* get_left()
284 return static_cast<link_type*
>(base::etl_left);
288 const link_type* get_left()
const
290 return static_cast<const link_type*
>(base::etl_left);
294 link_type* get_right()
296 return static_cast<link_type*
>(base::etl_right);
300 const link_type* get_right()
const
302 return static_cast<const link_type*
>(base::etl_right);
305 void move_impl(link_type& other)
307 const bool is_right = other.is_right_child();
308 base::etl_parent = other.etl_parent;
309 base::etl_left = other.etl_left;
310 base::etl_right = other.etl_right;
316 if (ETL_NULLPTR != base::etl_parent)
318 get_parent()->link_child(
this, is_right);
320 if (ETL_NULLPTR != base::etl_left)
322 get_left()->set_parent(
this);
324 if (ETL_NULLPTR != base::etl_right)
326 get_right()->set_parent(
this);
330 void rotate(
const bool is_right)
332 const bool was_right = is_right_child();
333 link_type*
const child = get_child(!is_right);
335 if (link_type*
const parent = child->get_parent())
337 parent->set_child(child, was_right);
342 link_type* adjust_balance(
const bool increase)
344 const int_fast8_t new_bf =
etl_bf + (increase ? +1 : -1);
345 if ((-1 <= new_bf) && (new_bf <= +1))
351 const bool is_right_rotation = new_bf < 0;
352 const int_fast8_t sign = is_right_rotation ? +1 : -1;
353 link_type*
const z_leaf = get_child(!is_right_rotation);
354 if (z_leaf->etl_bf * sign <= 0)
356 rotate(is_right_rotation);
357 if (z_leaf->etl_bf == 0)
360 z_leaf->etl_bf = +sign;
370 link_type*
const y_leaf = z_leaf->get_child(is_right_rotation);
371 z_leaf->rotate(!is_right_rotation);
372 rotate(is_right_rotation);
373 if (y_leaf->etl_bf == 0)
378 else if (y_leaf->etl_bf == sign)
382 z_leaf->etl_bf = -sign;
393 void link_child(link_type* child,
const bool is_right)
397 etl::link_right<base>(
this, child);
401 etl::link_left<base>(
this, child);
414 return ETL_NULLPTR == get_root();
422 size_t size() const ETL_NOEXCEPT
424 return get_origin().etl_size;
460 visit_post_order_impl(&origin,
false, unlinker);
461 origin.set_left(ETL_NULLPTR);
474 ETL_OR_STD::swap(origin, other.origin);
545 return static_cast<link_type*
>(origin.etl_left);
549 const link_type* get_root() const ETL_NOEXCEPT
551 return static_cast<const link_type*
>(origin.etl_left);
560 const link_type& get_origin() const ETL_NOEXCEPT
565 template <
typename TLink>
567 static TLink* get_origin(TLink* link) ETL_NOEXCEPT
569 while ((ETL_NULLPTR != link) && !link->is_origin())
571 link = link->get_parent();
577 static bool is_real_link(
const link_type* link) ETL_NOEXCEPT
579 return (ETL_NULLPTR != link) && !link->is_origin();
582 template <
typename TLink>
584 static TLink* begin_impl(TLink& origin) ETL_NOEXCEPT
586 TLink* curr = &origin;
587 TLink* next = curr->get_child(
false);
588 while (ETL_NULLPTR != next)
591 next = next->get_child(
false);
596 template <
typename TLink>
598 static TLink* end_impl(TLink& origin) ETL_NOEXCEPT
603 template <
typename TLink>
605 static TLink* find_extremum_impl(TLink* curr,
const bool is_max) ETL_NOEXCEPT
607 if (ETL_NULLPTR != curr)
609 TLink* next = curr->get_child(is_max);
610 while (ETL_NULLPTR != next)
613 next = curr->get_child(is_max);
619 template <
typename TLink>
621 static TLink* next_in_order_impl(TLink* curr) ETL_NOEXCEPT
623 if ((ETL_NULLPTR == curr) || curr->is_origin())
628 if (TLink*
const next = curr->get_child(
true))
630 return find_extremum_impl(next,
false);
633 while (curr->is_right_child())
635 curr = curr->get_parent();
637 return curr->get_parent();
640 template <
typename TLink>
642 static TLink* prev_in_order_impl(TLink* curr) ETL_NOEXCEPT
644 if (ETL_NULLPTR == curr)
649 if (TLink*
const next = curr->get_child(
false))
651 return find_extremum_impl(next,
true);
654 while (curr->is_left_child())
656 curr = curr->get_parent();
658 return curr->is_origin() ? curr : curr->get_parent();
661 template <
typename TLink,
typename Visitor>
662 static void visit_in_order_impl(TLink* curr,
const bool is_reverse, Visitor visitor)
664 TLink* prev = ETL_NULLPTR;
665 while (ETL_NULLPTR != curr)
667 TLink* next = curr->get_parent();
670 if (TLink*
const child1 = curr->get_child(is_reverse))
676 if (!curr->is_origin())
681 if (TLink*
const child2 = curr->get_child(!is_reverse))
687 else if (prev == curr->get_child(is_reverse))
689 if (!curr->is_origin())
694 if (TLink*
const child2 = curr->get_child(!is_reverse))
704 template <
typename TLink,
typename Visitor>
705 static void visit_post_order_impl(TLink* curr,
const bool is_reverse, Visitor visitor)
707 TLink* prev = ETL_NULLPTR;
708 while (ETL_NULLPTR != curr)
710 TLink* next = curr->get_parent();
713 if (TLink*
const child1 = curr->get_child(is_reverse))
717 else if (TLink*
const child2 = curr->get_child(!is_reverse))
721 else if (!curr->is_origin())
726 else if (prev == curr->get_child(is_reverse))
728 if (TLink*
const child2 = curr->get_child(!is_reverse))
732 else if (!curr->is_origin())
737 else if (!curr->is_origin())
746 template <
typename TLink,
typename Visitor>
747 static void visit_pre_order_impl(TLink* curr,
const bool is_reverse, Visitor visitor)
749 TLink* prev = ETL_NULLPTR;
750 while (ETL_NULLPTR != curr)
752 TLink* next = curr->get_parent();
755 if (!curr->is_origin())
760 if (TLink*
const child1 = curr->get_child(is_reverse))
764 else if (TLink*
const child2 = curr->get_child(!is_reverse))
769 else if (prev == curr->get_child(is_reverse))
771 if (TLink*
const child2 = curr->get_child(!is_reverse))
782 static int_fast8_t get_balance_factor_impl(
const link_type*
const curr) ETL_NOEXCEPT
784 return (ETL_NULLPTR != curr) ? curr->etl_bf : 0;
787 template <
typename TLink>
789 static TLink* get_parent_impl(TLink*
const curr) ETL_NOEXCEPT
791 if (ETL_NULLPTR == curr)
795 TLink*
const parent = curr->get_parent();
796 if ((ETL_NULLPTR == parent) || parent->is_origin())
803 template <
typename TLink>
805 static TLink* get_child_impl(TLink*
const curr,
const bool is_right) ETL_NOEXCEPT
807 if (ETL_NULLPTR == curr)
811 return curr->get_child(is_right);
814 template <
typename TValue,
typename TIterator,
typename TBinaryCompare>
815 void assign_impl(TIterator first, TIterator last, TBinaryCompare binary_comp)
817#if ETL_IS_DEBUG_BUILD
818 const intmax_t diff = etl::distance(first, last);
819 ETL_ASSERT(diff >= 0, ETL_ERROR(intrusive_avl_tree_iterator_exception));
823 while (first != last)
826 TValue& value =
static_cast<TValue&
>(link);
828 find_or_insert_impl<TValue>(
829 [&value, &binary_comp](
const TValue& other) {
return binary_comp(value, other); },
830 [&value] {
return &value; });
832 const CompareFactory<TValue, TBinaryCompare> compareFactory(value, binary_comp);
833 find_or_insert_impl<TValue>(compareFactory, compareFactory);
838 template <
typename TValue,
typename TLink,
typename TCompare>
839 static TValue* find_impl(TLink*
const root, TCompare comp)
843 while (ETL_NULLPTR != curr)
845 TValue*
const result =
static_cast<TValue*
>(curr);
846 const int cmp = comp(*result);
853 curr = curr->get_child(cmp > 0);
860 template <
typename TValue,
typename TCompare,
typename TFactory>
861 etl::pair<TValue*, bool> find_or_insert_impl(TCompare comp, TFactory factory)
864 bool is_right =
false;
867 while (ETL_NULLPTR != curr)
869 TValue*
const result =
static_cast<TValue*
>(curr);
870 const int cmp = comp(*result);
879 curr = curr->get_child(is_right);
883 TValue*
const result = factory();
884 if (ETL_NULLPTR == result)
891 ETL_ASSERT(!(result_link.is_linked()), ETL_ERROR(intrusive_avl_tree_value_is_already_linked));
894 parent->link_child(&result_link, is_right);
895 get_origin(parent)->etl_size += 1;
897 retrace_on_insert(&result_link);
903 template <
bool IsUpper,
typename TValue,
typename TLink,
typename TCompare>
904 static TValue* find_bound_impl(TLink*
const root, TCompare comp)
906 TValue* result = ETL_NULLPTR;
908 while (ETL_NULLPTR != next)
910 TValue*
const next_value =
static_cast<TValue*
>(next);
911 const int cmp = comp(*next_value);
912 if ((cmp > 0) || (IsUpper && (cmp == 0)))
914 next = next->get_right();
919 next = next->get_left();
925 static void erase_impl(
link_type*
const z_link) ETL_NOEXCEPT
930 if ((ETL_NULLPTR == z_link) || z_link->is_origin() || !z_link->is_linked())
935 link_type* parent = z_link->get_parent();
936 bool is_right = z_link->is_right_child();
938 if (!z_link->has_left())
940 parent->link_child(z_link->get_right(), is_right);
942 else if (!z_link->has_right())
944 parent->link_child(z_link->get_left(), is_right);
948 link_type*
const y_link = next_in_order_impl(z_link);
949 link_type*
const y_link_parent = y_link->get_parent();
950 y_link->
etl_bf = z_link->etl_bf;
951 if (z_link != y_link_parent)
953 y_link_parent->link_child(y_link->get_right(), y_link->is_right_child());
954 link_type*
const z_right = z_link->get_right();
955 y_link->set_right(z_right);
956 z_right->set_parent(y_link);
957 parent->link_child(y_link, is_right);
960 parent = y_link_parent;
964 parent->link_child(y_link, is_right);
969 link_type*
const z_left = z_link->get_left();
970 y_link->set_left(z_left);
971 z_left->set_parent(y_link);
975 z_link->etl_size = 0;
976 get_origin(parent)->etl_size -= 1;
978 retrace_on_erase(parent, is_right);
995 template <
typename TValue,
typename TBinaryCompare>
996 struct CompareFactory
999 TBinaryCompare binary_comp;
1001 CompareFactory(TValue& value, TBinaryCompare comp)
1009 int operator()(
const TValue& other)
const
1011 return binary_comp(value_ref, other);
1016 TValue* operator()()
const
1024 static void retrace_on_insert(
link_type* curr)
1027 while (!parent->is_origin())
1029 const bool is_right = curr->is_right_child();
1030 curr = parent->adjust_balance(is_right);
1031 parent = curr->get_parent();
1032 if (curr->etl_bf == 0)
1038 if (parent->is_origin())
1040 parent->set_left(curr);
1044 static void retrace_on_erase(
link_type* parent,
bool is_right)
1046 while (!parent->is_origin())
1048 link_type*
const curr = parent->adjust_balance(!is_right);
1049 parent = curr->get_parent();
1050 if ((curr->etl_bf != 0) || parent->is_origin())
1052 if (parent->is_origin())
1054 parent->set_left(curr);
1058 is_right = curr->is_right_child();
1076 template <
typename TValue,
size_t ID_ = 0>
1087 typedef TValue value_type;
1088 typedef value_type* pointer;
1089 typedef const value_type* const_pointer;
1090 typedef value_type& reference;
1091 typedef const value_type& const_reference;
1092 typedef size_t size_type;
1094 typedef value_type&& rvalue_reference;
1114 class iterator :
public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, value_type>
1118 friend class intrusive_avl_tree;
1119 friend class const_iterator;
1121 iterator() ETL_NOEXCEPT
1122 : p_value(ETL_NULLPTR)
1132 p_value = base::next_in_order_impl(p_value);
1143 iterator temp(*
this);
1144 p_value = base::next_in_order_impl(p_value);
1154 p_value = base::prev_in_order_impl(p_value);
1165 iterator temp(*
this);
1166 p_value = base::prev_in_order_impl(p_value);
1182 return *
static_cast<pointer
>(p_value);
1190 pointer
get() const ETL_NOEXCEPT
1192 return static_cast<pointer
>(has_value() ? p_value : ETL_NULLPTR);
1205 return static_cast<pointer
>(p_value);
1210 return lhs.p_value == rhs.p_value;
1215 return !(lhs == rhs);
1218 ETL_EXPLICIT
operator bool() const ETL_NOEXCEPT
1224 bool has_value() const ETL_NOEXCEPT
1226 return base::is_real_link(p_value);
1238 return base::get_balance_factor_impl(p_value);
1250 return iterator(base::get_parent_impl(p_value));
1262 return iterator(base::get_child_impl(p_value, is_right));
1267 ETL_EXPLICIT
iterator(link_type* value)
1290 class const_iterator :
public etl::iterator<ETL_OR_STD::bidirectional_iterator_tag, const value_type>
1294 friend class intrusive_avl_tree;
1296 const_iterator() ETL_NOEXCEPT
1297 : p_value(ETL_NULLPTR)
1303 : p_value(other.p_value)
1313 p_value = base::next_in_order_impl(p_value);
1323 const_iterator temp(*
this);
1324 p_value = base::next_in_order_impl(p_value);
1334 p_value = base::prev_in_order_impl(p_value);
1345 const_iterator temp(*
this);
1346 p_value = base::prev_in_order_impl(p_value);
1362 return *
static_cast<const_pointer
>(p_value);
1370 const_pointer
get() const ETL_NOEXCEPT
1372 return static_cast<const_pointer
>(has_value() ? p_value : ETL_NULLPTR);
1385 return static_cast<const_pointer
>(p_value);
1390 return lhs.p_value == rhs.p_value;
1395 return !(lhs == rhs);
1398 ETL_EXPLICIT
operator bool() const ETL_NOEXCEPT
1404 bool has_value() const ETL_NOEXCEPT
1406 return base::is_real_link(p_value);
1418 return base::get_balance_factor_impl(p_value);
1430 return const_iterator(base::get_parent_impl(p_value));
1440 const_iterator
get_child(
const bool is_right)
const ETL_NOEXCEPT
1442 return const_iterator(base::get_child_impl(p_value, is_right));
1492 template <
typename TIterator,
typename TBinaryCompare>
1494 typename etl::enable_if<!etl::is_integral<TIterator>::value,
int>
::type = 0)
1496 base::template assign_impl<value_type>(first, last, binary_comp);
1532 return iterator(base::begin_impl(base::get_origin()));
1564 return iterator(base::end_impl(base::get_origin()));
1643 template <
typename TCompare>
1646 pointer ptr = base::template find_bound_impl<false, value_type>(base::get_root(), comp);
1647 return make_iterator(ptr,
end());
1649 template <
typename TCompare>
1652 const_pointer ptr = base::template find_bound_impl<false, const value_type>(base::get_root(), comp);
1653 return make_iterator(ptr,
end());
1668 template <
typename TCompare>
1671 pointer ptr = base::template find_bound_impl<true, value_type>(base::get_root(), comp);
1672 return make_iterator(ptr,
end());
1674 template <
typename TCompare>
1677 const_pointer ptr = base::template find_bound_impl<true, const value_type>(base::get_root(), comp);
1678 return make_iterator(ptr,
end());
1718 template <
typename TCompare>
1721 pointer ptr = base::template find_impl<value_type>(base::get_root(), comp);
1722 return make_iterator(ptr,
end());
1738 template <
typename TCompare>
1741 const_pointer ptr = base::template find_impl<const value_type>(base::get_root(), comp);
1742 return make_iterator(ptr,
end());
1776 template <
typename TCompare,
typename TFactory>
1797#if ETL_IS_DEBUG_BUILD
1806 base::erase_impl(position.p_value);
1827 return erase(
iterator(
const_cast<link_type*
>(position.p_value)));
1840 template <
typename Visitor>
1844 base::visit_in_order_impl(
1845 &base::get_origin(), is_reverse,
1846 [&
visitor](link_type& link) {
visitor(
static_cast<reference
>(link)); });
1848 const CastingVisitor<reference, Visitor> casting_visitor(
visitor);
1849 base::visit_in_order_impl(&base::get_origin(), is_reverse, casting_visitor);
1862 template <
typename Visitor>
1866 base::visit_in_order_impl(
1867 &base::get_origin(), is_reverse,
1868 [&
visitor](
const link_type& link) {
visitor(
static_cast<const_reference
>(link)); });
1870 const CastingVisitor<const_reference, Visitor> casting_visitor(
visitor);
1871 base::visit_in_order_impl(&base::get_origin(), is_reverse, casting_visitor);
1888 template <
typename Visitor>
1892 base::visit_post_order_impl(
1893 &base::get_origin(), is_reverse,
1894 [&
visitor](link_type& link) {
visitor(
static_cast<reference
>(link)); });
1896 const CastingVisitor<reference, Visitor> casting_visitor(
visitor);
1897 base::visit_post_order_impl(&base::get_origin(), is_reverse, casting_visitor);
1913 template <
typename Visitor>
1917 base::visit_post_order_impl(
1918 &base::get_origin(), is_reverse,
1919 [&
visitor](
const link_type& link) {
visitor(
static_cast<const_reference
>(link)); });
1921 const CastingVisitor<const_reference, Visitor> casting_visitor(
visitor);
1922 base::visit_post_order_impl(&base::get_origin(), is_reverse, casting_visitor);
1939 template <
typename Visitor>
1943 base::visit_pre_order_impl(
1944 &base::get_origin(), is_reverse,
1945 [&
visitor](link_type& link) {
visitor(
static_cast<reference
>(link)); });
1947 const CastingVisitor<reference, Visitor> casting_visitor(
visitor);
1948 base::visit_pre_order_impl(&base::get_origin(), is_reverse, casting_visitor);
1964 template <
typename Visitor>
1968 base::visit_pre_order_impl(
1969 &base::get_origin(), is_reverse,
1970 [&
visitor](
const link_type& link) {
visitor(
static_cast<const_reference
>(link)); });
1972 const CastingVisitor<const_reference, Visitor> casting_visitor(
visitor);
1973 base::visit_pre_order_impl(&base::get_origin(), is_reverse, casting_visitor);
1985 template <
typename T,
typename Visitor>
1986 struct CastingVisitor
1989 ETL_EXPLICIT CastingVisitor(Visitor&
visitor)
1994 template <
typename TLink>
1995 void operator()(TLink& link)
const
1997 visitor(
static_cast<T
>(link));
2002 template <
typename TIterator,
typename Po
inter>
2004 static TIterator make_iterator(Pointer
const ptr,
const TIterator
end)
2006 return (ETL_NULLPTR != ptr) ? TIterator(ptr) :
end;
Definition intrusive_avl_tree.h:1291
const_iterator operator--(int) ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1343
const_iterator & operator--() ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1332
ETL_NODISCARD const_iterator get_child(const bool is_right) const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1440
ETL_NODISCARD int_fast8_t get_balance_factor() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1416
ETL_NODISCARD const_iterator get_parent() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1428
const_iterator & operator++() ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1311
const_pointer get() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1370
const_iterator operator++(int) ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1321
const_pointer operator->() const
Definition intrusive_avl_tree.h:1381
Definition intrusive_avl_tree.h:1115
iterator operator--(int) ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1163
ETL_NODISCARD int_fast8_t get_balance_factor() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1236
iterator & operator++() ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1130
ETL_NODISCARD iterator get_parent() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1248
ETL_NODISCARD iterator get_child(const bool is_right) const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1260
iterator operator++(int) ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1141
iterator & operator--() ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1152
pointer get() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1190
pointer operator->() const
Definition intrusive_avl_tree.h:1201
Definition intrusive_avl_tree.h:96
friend void swap(intrusive_avl_tree_base &lhs, intrusive_avl_tree_base &rhs) ETL_NOEXCEPT
Definition intrusive_avl_tree.h:483
ETL_NODISCARD size_t size() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:422
void swap(intrusive_avl_tree_base &other) ETL_NOEXCEPT
Definition intrusive_avl_tree.h:470
~intrusive_avl_tree_base()
Definition intrusive_avl_tree.h:534
void clear() ETL_NOEXCEPT
Definition intrusive_avl_tree.h:436
intrusive_avl_tree_base() ETL_NOEXCEPT
Default constructor.
Definition intrusive_avl_tree.h:496
ETL_NODISCARD bool empty() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:412
Definition intrusive_avl_tree.h:65
Definition intrusive_avl_tree.h:1078
ETL_NODISCARD iterator max() ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1593
ETL_NODISCARD iterator get_root() ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1688
ETL_NODISCARD iterator min() ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1615
iterator erase(iterator position)
Definition intrusive_avl_tree.h:1794
iterator lower_bound(TCompare comp)
Definition intrusive_avl_tree.h:1644
iterator upper_bound(TCompare comp)
Definition intrusive_avl_tree.h:1669
iterator erase(const_iterator position)
Definition intrusive_avl_tree.h:1822
~intrusive_avl_tree()
Definition intrusive_avl_tree.h:1503
ETL_NODISCARD const_iterator max() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1604
void visit_pre_order(const bool is_reverse, Visitor visitor)
Definition intrusive_avl_tree.h:1940
void visit_post_order(const bool is_reverse, Visitor visitor) const
Definition intrusive_avl_tree.h:1914
ETL_NODISCARD const_iterator begin() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1541
ETL_NODISCARD const_iterator cbegin() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1552
void visit_post_order(const bool is_reverse, Visitor visitor)
Definition intrusive_avl_tree.h:1889
ETL_NODISCARD iterator end() ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1562
intrusive_avl_tree() ETL_NOEXCEPT
Default constructor.
Definition intrusive_avl_tree.h:1459
etl::pair< iterator, bool > find_or_insert(TCompare comp, TFactory factory)
Definition intrusive_avl_tree.h:1777
iterator find(TCompare comp)
Definition intrusive_avl_tree.h:1719
void visit_pre_order(const bool is_reverse, Visitor visitor) const
Definition intrusive_avl_tree.h:1965
ETL_NODISCARD const_iterator cend() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1582
ETL_NODISCARD const_iterator min() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1626
const_iterator find(TCompare comp) const
Definition intrusive_avl_tree.h:1739
ETL_NODISCARD iterator begin() ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1530
ETL_NODISCARD const_iterator get_root() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1700
intrusive_avl_tree(TIterator first, TIterator last, TBinaryCompare binary_comp, typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type=0)
Definition intrusive_avl_tree.h:1493
ETL_NODISCARD const_iterator end() const ETL_NOEXCEPT
Definition intrusive_avl_tree.h:1572
void visit_in_order(const bool is_reverse, Visitor visitor)
Definition intrusive_avl_tree.h:1841
void visit_in_order(const bool is_reverse, Visitor visitor) const
Definition intrusive_avl_tree.h:1863
#define ETL_ASSERT(b, e)
Definition error_handler.h:511
ETL_EXCEPTION_CONSTEXPR exception(string_type reason_, string_type, numeric_type)
Constructor.
Definition exception.h:81
pair< T1, T2 > make_pair(T1 a, T2 b)
A convenience wrapper for creating a pair from two objects.
Definition utility.h:335
T exchange(T &object, const T &new_value)
exchange (const)
Definition utility.h:498
ETL_CONSTEXPR14 enable_if<!etl::is_specialization< TRep2, etl::chrono::duration >::value, etl::chrono::duration< typenameetl::common_type< TRep1, TRep2 >::type, TPeriod1 > >::type operator*(const etl::chrono::duration< TRep1, TPeriod1 > &lhs, const TRep2 &rhs) ETL_NOEXCEPT
Operator *.
Definition duration.h:541
etl::enable_if< etl::is_same< TLink, etl::tree_link< TLink::ID > >::value, void >::type link_rotate(TLink &parent, TLink &child)
Automatically detects whether a left or right rotate is expected.
Definition intrusive_links.h:1377
Definition intrusive_avl_tree.h:118
~link_type()
Definition intrusive_avl_tree.h:193
size_t etl_size
Stores total number of items in the tree (origin node only).
Definition intrusive_avl_tree.h:208
int_fast8_t etl_bf
Stores -1, 0, or +1 balancing factor in the real nodes.
Definition intrusive_avl_tree.h:207
iterator
Definition iterator.h:482
pair holds two objects of arbitrary type
Definition utility.h:176
T1 first
first is a copy of the first object
Definition utility.h:180
T2 second
second is a copy of the second object
Definition utility.h:181
A binary tree link.
Definition intrusive_links.h:984
ETL_CONSTEXPR14 bool operator==(const etl::to_arithmetic_result< T > &lhs, const etl::to_arithmetic_result< T > &rhs)
Equality test for etl::to_arithmetic_result.
Definition to_arithmetic.h:903
ETL_CONSTEXPR14 bool operator!=(const etl::to_arithmetic_result< T > &lhs, const etl::to_arithmetic_result< T > &rhs)
Inequality test for etl::to_arithmetic_result.
Definition to_arithmetic.h:937