31#ifndef ETL_INTRUSIVE_LINKS_INCLUDED
32#define ETL_INTRUSIVE_LINKS_INCLUDED
63 link_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
64 :
exception(reason_, file_name_, line_number_)
76 not_unlinked_exception(string_type file_name_, numeric_type line_number_)
77 : link_exception(ETL_ERROR_TEXT(
"link:still linked", ETL_INTRUSIVE_LINKS_FILE_ID
"A"), file_name_, line_number_)
95 : etl_next(ETL_NULLPTR)
100 forward_link(forward_link* p_next)
106 forward_link(
const forward_link& other)
107 : etl_next(other.etl_next)
112 forward_link& operator=(
const forward_link& other)
114 etl_next = other.etl_next;
122 etl_next = ETL_NULLPTR;
127 bool is_linked()
const
129 return etl_next != ETL_NULLPTR;
134 bool has_next()
const
136 return etl_next != ETL_NULLPTR;
140 void set_next(forward_link* n)
146 void set_next(forward_link& n)
153 forward_link* get_next()
const
158 forward_link* etl_next;
162 template <
typename TLink>
165 static ETL_CONSTANT
bool value = etl::is_same<TLink, etl::forward_link<TLink::ID> >::value;
170 template <
typename TLink>
171 inline constexpr bool is_forward_link_v = etl::is_forward_link<TLink>::value;
178 template <
typename TLink>
179 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>
::type link(TLink& lhs, TLink& rhs)
186 template <
typename TLink>
187 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>
::type link(TLink* lhs, TLink* rhs)
189 if (lhs != ETL_NULLPTR)
197 template <
typename TLink>
198 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type link(TLink& lhs, TLink* rhs)
205 template <
typename TLink>
206 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type link(TLink* lhs, TLink& rhs)
208 if (lhs != ETL_NULLPTR)
210 lhs->etl_next = &rhs;
218 template <
typename TLink>
219 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type link_splice(TLink& lhs, TLink& rhs)
221 rhs.etl_next = lhs.etl_next;
227 template <
typename TLink>
228 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type link_splice(TLink* lhs, TLink* rhs)
230 if (lhs != ETL_NULLPTR)
232 if (rhs != ETL_NULLPTR)
234 rhs->etl_next = lhs->etl_next;
243 template <
typename TLink>
244 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type link_splice(TLink& lhs, TLink* rhs)
246 if (rhs != ETL_NULLPTR)
248 rhs->etl_next = lhs.etl_next;
256 template <
typename TLink>
257 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type link_splice(TLink* lhs, TLink& rhs)
259 if (lhs != ETL_NULLPTR)
261 rhs.etl_next = lhs->etl_next;
262 lhs->etl_next = &rhs;
268 template <
typename TLink>
269 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type link_splice(TLink& lhs, TLink& first, TLink& last)
271 last.etl_next = lhs.etl_next;
272 lhs.etl_next = &first;
277 template <
typename TLink>
278 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type link_splice(TLink* lhs, TLink& first, TLink& last)
280 if (lhs != ETL_NULLPTR)
282 last.etl_next = lhs->etl_next;
283 lhs->etl_next = &first;
287 last.etl_next = ETL_NULLPTR;
295 template <
typename TLink>
296 typename etl::enable_if<etl::is_forward_link<TLink>::value, TLink*>::type unlink_after(TLink& node)
298 if (node.etl_next != ETL_NULLPTR)
300 TLink* unlinked_node = node.etl_next;
301 node.etl_next = unlinked_node->etl_next;
302 unlinked_node->clear();
303 return unlinked_node;
306 return node.etl_next;
311 template <
typename TLink>
312 typename etl::enable_if<etl::is_forward_link<TLink>::value, TLink*>::type unlink_after(TLink& before, TLink& last)
314 TLink* first = before.etl_next;
316 if (&before != &last)
318 before.etl_next = last.etl_next;
326 template <
typename TLink>
327 typename etl::enable_if<etl::is_forward_link<TLink>::value,
bool>::type is_linked(TLink& node)
329 return node.is_linked();
333 template <
typename TLink>
334 typename etl::enable_if<etl::is_forward_link<TLink>::value,
bool>::type is_linked(TLink* node)
336 return node->is_linked();
343 template <
typename TLink>
344 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type link_clear(TLink& start)
346 start.etl_next = ETL_NULLPTR;
351 template <
typename TLink>
352 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type link_clear(TLink* start)
354 if (start != ETL_NULLPTR)
356 etl::link_clear(*start);
364 template <
typename TLink>
365 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type link_clear_range(TLink& start)
367 TLink* current = &start;
369 while (current != ETL_NULLPTR)
371 TLink* next = current->etl_next;
379 template <
typename TLink>
380 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type link_clear_range(TLink* start)
382 if (start != ETL_NULLPTR)
384 etl::link_clear_range(*start);
392 template <
typename TLink,
typename... TLinks>
393 typename etl::enable_if<etl::is_forward_link<TLink>::value, TLink*>::type create_linked_list(TLink& first, TLinks&... links)
395 TLink* current = &first;
396 ((current->etl_next = &links, current = &links), ...);
404 template <
typename TLink,
typename... TLinks>
405 typename etl::enable_if<etl::is_forward_link<TLink>::value, TLink*>::type create_linked_list(TLink* first, TLinks*... links)
407 if (first != ETL_NULLPTR)
409 return create_linked_list(*first, (*links)...);
420 template <
typename TLink>
421 typename etl::enable_if<etl::is_forward_link<TLink>::value, TLink*>::type create_linked_list(TLink& first)
429 template <
typename TLink,
typename... TLinks>
430 typename etl::enable_if<etl::is_forward_link<TLink>::value, TLink*>::type create_linked_list(TLink& first, TLink& next, TLinks&... links)
432 first.etl_next = &next;
433 return create_linked_list(next,
static_cast<TLink&
>(links)...);
439 template <
typename TLink>
440 typename etl::enable_if<etl::is_forward_link<TLink>::value, TLink*>::type create_linked_list(TLink* first)
442 if (first != ETL_NULLPTR)
444 return create_linked_list(*first);
455 template <
typename TLink,
typename... TLinks>
456 typename etl::enable_if<etl::is_forward_link<TLink>::value, TLink*>::type create_linked_list(TLink* first, TLink* next, TLinks*... links)
458 if (first != ETL_NULLPTR)
460 return create_linked_list(*first, *next,
static_cast<TLink&
>(*links)...);
470 template <
typename TLink>
471 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type detach_linked_list(TLink& first)
473 link_clear_range(first);
477 template <
typename TLink>
478 typename etl::enable_if<etl::is_forward_link<TLink>::value,
void>::type detach_linked_list(TLink* first)
480 if (first != ETL_NULLPTR)
482 detach_linked_list(*first);
489 template <
size_t ID_>
490 struct bidirectional_link
499 : etl_previous(ETL_NULLPTR)
500 , etl_next(ETL_NULLPTR)
505 bidirectional_link(bidirectional_link* p_previous, bidirectional_link* p_next)
506 : etl_previous(p_previous)
512 bidirectional_link(
const bidirectional_link& other)
513 : etl_previous(other.etl_previous)
514 , etl_next(other.etl_next)
519 bidirectional_link& operator=(
const bidirectional_link& other)
521 etl_previous = other.etl_previous;
522 etl_next = other.etl_next;
530 etl_previous = ETL_NULLPTR;
531 etl_next = ETL_NULLPTR;
536 bool is_linked()
const
538 return (etl_previous != ETL_NULLPTR) || (etl_next != ETL_NULLPTR);
543 bool has_next()
const
545 return etl_next != ETL_NULLPTR;
550 bool has_previous()
const
552 return etl_previous != ETL_NULLPTR;
556 void set_next(bidirectional_link* n)
562 void set_next(bidirectional_link& n)
569 bidirectional_link* get_next()
const
575 void set_previous(bidirectional_link* n)
581 void set_previous(bidirectional_link& n)
588 bidirectional_link* get_previous()
const
596 using ETL_OR_STD::swap;
597 swap(etl_previous, etl_next);
604 if (etl_previous != ETL_NULLPTR)
606 etl_previous->etl_next = etl_next;
610 if (etl_next != ETL_NULLPTR)
612 etl_next->etl_previous = etl_previous;
618 bidirectional_link* etl_previous;
619 bidirectional_link* etl_next;
623 template <
typename TLink>
626 static ETL_CONSTANT
bool value = etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value;
631 template <
typename TLink>
632 inline constexpr bool is_bidirectional_link_v = etl::is_bidirectional_link<TLink>::value;
639 template <
typename TLink>
640 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
void>
::type link(TLink& lhs, TLink& rhs)
643 rhs.etl_previous = &lhs;
648 template <
typename TLink>
649 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
void>
::type link(TLink* lhs, TLink* rhs)
651 if (lhs != ETL_NULLPTR)
656 if (rhs != ETL_NULLPTR)
658 rhs->etl_previous = lhs;
664 template <
typename TLink>
665 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
void>::type link(TLink& lhs, TLink* rhs)
669 if (rhs != ETL_NULLPTR)
671 rhs->etl_previous = &lhs;
677 template <
typename TLink>
678 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
void>::type link(TLink* lhs, TLink& rhs)
680 if (lhs != ETL_NULLPTR)
682 lhs->etl_next = &rhs;
685 rhs.etl_previous = lhs;
690 template <
typename TLink>
691 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
void>::type link_splice(TLink& lhs, TLink& rhs)
693 rhs.etl_next = lhs.etl_next;
694 rhs.etl_previous = &lhs;
696 if (lhs.etl_next != ETL_NULLPTR)
698 lhs.etl_next->etl_previous = &rhs;
708 template <
typename TLink>
709 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
void>::type link_splice(TLink* lhs, TLink* rhs)
711 if (rhs != ETL_NULLPTR)
713 if (lhs != ETL_NULLPTR)
715 rhs->etl_next = lhs->etl_next;
718 rhs->etl_previous = lhs;
721 if (lhs != ETL_NULLPTR)
723 if (lhs->etl_next != ETL_NULLPTR)
725 lhs->etl_next->etl_previous = rhs;
734 template <
typename TLink>
735 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
void>::type link_splice(TLink& lhs, TLink* rhs)
737 if (rhs != ETL_NULLPTR)
739 rhs->etl_next = lhs.etl_next;
740 rhs->etl_previous = &lhs;
743 if (lhs.etl_next != ETL_NULLPTR)
745 lhs.etl_next->etl_previous = rhs;
753 template <
typename TLink>
754 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
void>::type link_splice(TLink* lhs, TLink& rhs)
756 if (lhs != ETL_NULLPTR)
758 rhs.etl_next = lhs->etl_next;
761 rhs.etl_previous = lhs;
763 if (lhs != ETL_NULLPTR)
765 if (lhs->etl_next != ETL_NULLPTR)
767 lhs->etl_next->etl_previous = &rhs;
770 lhs->etl_next = &rhs;
776 template <
typename TLink>
777 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
void>::type link_splice(TLink& lhs, TLink& first,
780 last.etl_next = lhs.etl_next;
781 first.etl_previous = &lhs;
783 if (last.etl_next != ETL_NULLPTR)
785 last.etl_next->etl_previous = &last;
788 lhs.etl_next = &first;
793 template <
typename TLink>
794 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
void>::type link_splice(TLink* lhs, TLink& first,
797 if (lhs != ETL_NULLPTR)
799 last.etl_next = lhs->etl_next;
803 last.etl_next = ETL_NULLPTR;
806 first.etl_previous = lhs;
808 if (last.etl_next != ETL_NULLPTR)
810 last.etl_next->etl_previous = &last;
813 if (lhs != ETL_NULLPTR)
815 lhs->etl_next = &first;
823 template <
typename TLink>
824 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
void>::type unlink(TLink& node)
831 template <
typename TLink>
832 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value, TLink&>::type unlink(TLink& first, TLink& last)
840 if (last.etl_next != ETL_NULLPTR)
842 last.etl_next->etl_previous = first.etl_previous;
845 if (first.etl_previous != ETL_NULLPTR)
847 first.etl_previous->etl_next = last.etl_next;
850 first.etl_previous = ETL_NULLPTR;
851 last.etl_next = ETL_NULLPTR;
858 template <
typename TLink>
859 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
bool>::type is_linked(TLink& node)
861 return node.is_linked();
865 template <
typename TLink>
866 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
bool>::type is_linked(TLink* node)
868 return node->is_linked();
875 template <
typename TLink>
876 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
void>::type link_clear_range(TLink& start)
878 TLink* current = &start;
880 while (current != ETL_NULLPTR)
882 TLink* next = current->etl_next;
890 template <
typename TLink>
891 typename etl::enable_if< etl::is_same<TLink, etl::bidirectional_link<TLink::ID> >::value,
void>::type link_clear_range(TLink* start)
893 etl::link_clear_range(*start);
900 template <
typename TLink,
typename... TLinks>
901 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value, TLink*>::type create_linked_list(TLink& first, TLinks&... links)
903 TLink* current = &first;
904 ((current->etl_next = &links,
static_cast<TLink&
>(links).etl_previous = current, current = &links), ...);
912 template <
typename TLink,
typename... TLinks>
913 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value, TLink*>::type create_linked_list(TLink* first, TLinks*... links)
915 TLink* current = first;
916 ((current->etl_next = links,
static_cast<TLink*
>(links)->etl_previous = current, current = links), ...);
924 template <
typename TLink>
925 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value, TLink*>::type create_linked_list(TLink& first)
933 template <
typename TLink,
typename... TLinks>
934 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value, TLink*>::type create_linked_list(TLink& first, TLink& next, TLinks&... links)
936 first.etl_next = &next;
937 next.etl_previous = &first;
939 return create_linked_list(next,
static_cast<TLink&
>(links)...);
945 template <
typename TLink,
typename... TLinks>
946 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value, TLink*>::type create_linked_list(TLink* first, TLink* next, TLinks*... links)
948 if (first != ETL_NULLPTR)
950 return create_linked_list(*first, *next,
static_cast<TLink&
>(*links)...);
960 template <
typename TLink>
961 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value,
void>::type detach_linked_list(TLink& first)
963 link_clear_range(first);
967 template <
typename TLink>
968 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value,
void>::type detach_linked_list(TLink* first)
970 if (first != ETL_NULLPTR)
972 detach_linked_list(*first);
979 template <
size_t ID_>
989 : etl_parent(ETL_NULLPTR)
990 , etl_left(ETL_NULLPTR)
991 , etl_right(ETL_NULLPTR)
996 tree_link(tree_link* p_parent, tree_link* p_left, tree_link* p_right)
997 : etl_parent(p_parent)
1004 tree_link(
const tree_link& other)
1005 : etl_parent(other.etl_parent)
1006 , etl_left(other.etl_left)
1007 , etl_right(other.etl_right)
1012 tree_link& operator=(
const tree_link& other)
1014 etl_parent = other.etl_parent;
1015 etl_left = other.etl_left;
1016 etl_right = other.etl_right;
1024 etl_parent = ETL_NULLPTR;
1025 etl_left = ETL_NULLPTR;
1026 etl_right = ETL_NULLPTR;
1030 bool is_linked()
const
1032 return (etl_parent != ETL_NULLPTR) || (etl_left != ETL_NULLPTR) || (etl_right != ETL_NULLPTR);
1037 bool has_parent()
const
1039 return etl_parent != ETL_NULLPTR;
1044 bool has_left()
const
1046 return etl_left != ETL_NULLPTR;
1051 bool has_right()
const
1053 return etl_right != ETL_NULLPTR;
1057 void set_parent(tree_link* p)
1063 void set_left(tree_link* l)
1069 void set_right(tree_link* r)
1075 void set_parent(tree_link& p)
1081 void set_left(tree_link& l)
1087 void set_right(tree_link& r)
1094 tree_link* get_parent()
const
1101 tree_link* get_left()
const
1108 tree_link* get_right()
const
1116 using ETL_OR_STD::swap;
1117 swap(etl_left, etl_right);
1120 tree_link* etl_parent;
1121 tree_link* etl_left;
1122 tree_link* etl_right;
1126 template <
typename TLink>
1129 static ETL_CONSTANT
bool value = etl::is_same<TLink, etl::tree_link<TLink::ID> >::value;
1134 template <
typename TLink>
1135 inline constexpr bool is_tree_link_v = etl::is_tree_link<TLink>::value;
1143 template <
typename TLink>
1144 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_left(TLink& parent, TLink& child)
1146 parent.etl_left = &child;
1147 child.etl_parent = &parent;
1152 template <
typename TLink>
1153 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_left(TLink* parent, TLink* child)
1155 if (parent != ETL_NULLPTR)
1157 parent->etl_left = child;
1160 if (child != ETL_NULLPTR)
1162 child->etl_parent = parent;
1168 template <
typename TLink>
1169 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_left(TLink& parent, TLink* child)
1171 parent.etl_left = child;
1173 if (child != ETL_NULLPTR)
1175 child->etl_parent = &parent;
1181 template <
typename TLink>
1182 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_left(TLink* parent, TLink& child)
1184 if (parent != ETL_NULLPTR)
1186 parent->etl_left = &child;
1189 child.etl_parent = parent;
1196 template <
typename TLink>
1197 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_right(TLink& parent, TLink& child)
1199 parent.etl_right = &child;
1200 child.etl_parent = &parent;
1204 template <
typename TLink>
1205 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_right(TLink* parent, TLink* child)
1207 if (parent != ETL_NULLPTR)
1209 parent->etl_right = child;
1212 if (child != ETL_NULLPTR)
1214 child->etl_parent = parent;
1219 template <
typename TLink>
1220 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_right(TLink& parent, TLink* child)
1222 parent.etl_right = child;
1224 if (child != ETL_NULLPTR)
1226 child->etl_parent = &parent;
1231 template <
typename TLink>
1232 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_right(TLink* parent, TLink& child)
1234 if (parent != ETL_NULLPTR)
1236 parent->etl_right = &child;
1239 child.etl_parent = parent;
1246 template <
typename TLink>
1247 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_left(TLink& parent, TLink& child)
1249 TLink* grandparent = parent.etl_parent;
1251 parent.etl_right = child.etl_left;
1253 if (parent.etl_right != ETL_NULLPTR)
1255 parent.etl_right->etl_parent = &parent;
1258 child.etl_parent = grandparent;
1259 parent.etl_parent = &child;
1260 child.etl_left = &parent;
1262 if (grandparent != ETL_NULLPTR)
1264 if (grandparent->etl_left == &parent)
1266 grandparent->etl_left = &child;
1268 else if (grandparent->etl_right == &parent)
1270 grandparent->etl_right = &child;
1277 template <
typename TLink>
1278 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_left(TLink* parent, TLink* child)
1280 if ((parent != ETL_NULLPTR) && (child != ETL_NULLPTR))
1282 link_rotate_left(*parent, *child);
1288 template <
typename TLink>
1289 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_left(TLink& parent, TLink* child)
1291 if (child != ETL_NULLPTR)
1293 link_rotate_left(parent, *child);
1299 template <
typename TLink>
1300 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_left(TLink* parent, TLink& child)
1302 if (parent != ETL_NULLPTR)
1304 link_rotate_left(*parent, child);
1311 template <
typename TLink>
1312 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_right(TLink& parent, TLink& child)
1314 TLink* grandparent = parent.etl_parent;
1316 parent.etl_left = child.etl_right;
1318 if (parent.etl_left != ETL_NULLPTR)
1320 parent.etl_left->etl_parent = &parent;
1323 child.etl_parent = grandparent;
1324 parent.etl_parent = &child;
1325 child.etl_right = &parent;
1327 if (grandparent != ETL_NULLPTR)
1329 if (grandparent->etl_left == &parent)
1331 grandparent->etl_left = &child;
1333 else if (grandparent->etl_right == &parent)
1335 grandparent->etl_right = &child;
1340 template <
typename TLink>
1341 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_right(TLink* parent, TLink* child)
1343 if ((parent != ETL_NULLPTR) && (child != ETL_NULLPTR))
1345 link_rotate_right(*parent, *child);
1349 template <
typename TLink>
1350 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_right(TLink& parent, TLink* child)
1352 if (child != ETL_NULLPTR)
1354 link_rotate_right(parent, *child);
1359 template <
typename TLink>
1360 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_right(TLink* parent, TLink& child)
1362 if (parent != ETL_NULLPTR)
1364 link_rotate_right(*parent, child);
1373 template <
typename TLink>
1374 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_rotate(TLink& parent, TLink& child)
1376 if (parent.etl_left == &child)
1378 etl::link_rotate_right(parent, child);
1382 etl::link_rotate_left(parent, child);
1389 template <
typename TLink>
1390 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_rotate(TLink* parent, TLink* child)
1392 if ((parent != ETL_NULLPTR) && (child != ETL_NULLPTR))
1394 if (parent->etl_left == child)
1396 etl::link_rotate_right(*parent, *child);
1400 etl::link_rotate_left(*parent, *child);
1408 template <
typename TLink>
1409 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_rotate(TLink& parent, TLink* child)
1411 if (child != ETL_NULLPTR)
1413 if (parent.etl_left == child)
1415 etl::link_rotate_right(parent, *child);
1419 etl::link_rotate_left(parent, *child);
1427 template <
typename TLink>
1428 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_rotate(TLink* parent, TLink& child)
1430 if (parent != ETL_NULLPTR)
1432 if (parent->etl_left == &child)
1434 etl::link_rotate_right(*parent, child);
1438 etl::link_rotate_left(*parent, child);
1444 template <
typename TLink>
1445 typename etl::enable_if< etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_clear(TLink& node)
1451 template <
typename TLink>
1452 typename etl::enable_if< etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_clear(TLink* node)
1458 template <
typename TLink>
1459 typename etl::enable_if< etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
bool>::type is_linked(TLink& node)
1461 return node.is_linked();
1465 template <
typename TLink>
1466 typename etl::enable_if< etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
bool>::type is_linked(TLink* node)
1468 return node->is_linked();
Link exception.
Definition intrusive_links.h:60
ETL_EXCEPTION_CONSTEXPR exception(string_type reason_, string_type, numeric_type)
Constructor.
Definition exception.h:81
Definition exception.h:59
bitset_ext
Definition absolute.h:40
ETL_CONSTEXPR14 void swap(etl::typed_storage_ext< T > &lhs, etl::typed_storage_ext< T > &rhs) ETL_NOEXCEPT
Swap two etl::typed_storage_ext.
Definition alignment.h:856
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:1374
Definition intrusive_links.h:625
Definition intrusive_links.h:164
Definition intrusive_links.h:1128