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_)
94 ETL_CONSTEXPR forward_link()
95 : etl_next(ETL_NULLPTR)
100 ETL_CONSTEXPR forward_link(forward_link* p_next)
106 ETL_CONSTEXPR forward_link(
const forward_link& other)
107 : etl_next(other.etl_next)
112 ETL_CONSTEXPR14 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
498 ETL_CONSTEXPR bidirectional_link()
499 : etl_previous(ETL_NULLPTR)
500 , etl_next(ETL_NULLPTR)
505 ETL_CONSTEXPR bidirectional_link(bidirectional_link* p_previous, bidirectional_link* p_next)
506 : etl_previous(p_previous)
512 ETL_CONSTEXPR bidirectional_link(
const bidirectional_link& other)
513 : etl_previous(other.etl_previous)
514 , etl_next(other.etl_next)
519 ETL_CONSTEXPR14 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 if (start != ETL_NULLPTR)
895 etl::link_clear_range(*start);
903 template <
typename TLink,
typename... TLinks>
904 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value, TLink*>::type create_linked_list(TLink& first, TLinks&... links)
906 TLink* current = &first;
907 ((current->etl_next = &links,
static_cast<TLink&
>(links).etl_previous = current, current = &links), ...);
915 template <
typename TLink,
typename... TLinks>
916 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value, TLink*>::type create_linked_list(TLink* first, TLinks*... links)
918 TLink* current = first;
919 ((current->etl_next = links,
static_cast<TLink*
>(links)->etl_previous = current, current = links), ...);
927 template <
typename TLink>
928 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value, TLink*>::type create_linked_list(TLink& first)
936 template <
typename TLink,
typename... TLinks>
937 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value, TLink*>::type create_linked_list(TLink& first, TLink& next, TLinks&... links)
939 first.etl_next = &next;
940 next.etl_previous = &first;
942 return create_linked_list(next,
static_cast<TLink&
>(links)...);
948 template <
typename TLink,
typename... TLinks>
949 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value, TLink*>::type create_linked_list(TLink* first, TLink* next, TLinks*... links)
951 if (first != ETL_NULLPTR)
953 return create_linked_list(*first, *next,
static_cast<TLink&
>(*links)...);
963 template <
typename TLink>
964 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value,
void>::type detach_linked_list(TLink& first)
966 link_clear_range(first);
970 template <
typename TLink>
971 typename etl::enable_if<etl::is_bidirectional_link<TLink>::value,
void>::type detach_linked_list(TLink* first)
973 if (first != ETL_NULLPTR)
975 detach_linked_list(*first);
982 template <
size_t ID_>
992 : etl_parent(ETL_NULLPTR)
993 , etl_left(ETL_NULLPTR)
994 , etl_right(ETL_NULLPTR)
999 tree_link(tree_link* p_parent, tree_link* p_left, tree_link* p_right)
1000 : etl_parent(p_parent)
1002 , etl_right(p_right)
1007 tree_link(
const tree_link& other)
1008 : etl_parent(other.etl_parent)
1009 , etl_left(other.etl_left)
1010 , etl_right(other.etl_right)
1015 tree_link& operator=(
const tree_link& other)
1017 etl_parent = other.etl_parent;
1018 etl_left = other.etl_left;
1019 etl_right = other.etl_right;
1027 etl_parent = ETL_NULLPTR;
1028 etl_left = ETL_NULLPTR;
1029 etl_right = ETL_NULLPTR;
1033 bool is_linked()
const
1035 return (etl_parent != ETL_NULLPTR) || (etl_left != ETL_NULLPTR) || (etl_right != ETL_NULLPTR);
1040 bool has_parent()
const
1042 return etl_parent != ETL_NULLPTR;
1047 bool has_left()
const
1049 return etl_left != ETL_NULLPTR;
1054 bool has_right()
const
1056 return etl_right != ETL_NULLPTR;
1060 void set_parent(tree_link* p)
1066 void set_left(tree_link* l)
1072 void set_right(tree_link* r)
1078 void set_parent(tree_link& p)
1084 void set_left(tree_link& l)
1090 void set_right(tree_link& r)
1097 tree_link* get_parent()
const
1104 tree_link* get_left()
const
1111 tree_link* get_right()
const
1119 using ETL_OR_STD::swap;
1120 swap(etl_left, etl_right);
1123 tree_link* etl_parent;
1124 tree_link* etl_left;
1125 tree_link* etl_right;
1129 template <
typename TLink>
1132 static ETL_CONSTANT
bool value = etl::is_same<TLink, etl::tree_link<TLink::ID> >::value;
1137 template <
typename TLink>
1138 inline constexpr bool is_tree_link_v = etl::is_tree_link<TLink>::value;
1146 template <
typename TLink>
1147 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_left(TLink& parent, TLink& child)
1149 parent.etl_left = &child;
1150 child.etl_parent = &parent;
1155 template <
typename TLink>
1156 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_left(TLink* parent, TLink* child)
1158 if (parent != ETL_NULLPTR)
1160 parent->etl_left = child;
1163 if (child != ETL_NULLPTR)
1165 child->etl_parent = parent;
1171 template <
typename TLink>
1172 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_left(TLink& parent, TLink* child)
1174 parent.etl_left = child;
1176 if (child != ETL_NULLPTR)
1178 child->etl_parent = &parent;
1184 template <
typename TLink>
1185 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_left(TLink* parent, TLink& child)
1187 if (parent != ETL_NULLPTR)
1189 parent->etl_left = &child;
1192 child.etl_parent = parent;
1199 template <
typename TLink>
1200 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_right(TLink& parent, TLink& child)
1202 parent.etl_right = &child;
1203 child.etl_parent = &parent;
1207 template <
typename TLink>
1208 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_right(TLink* parent, TLink* child)
1210 if (parent != ETL_NULLPTR)
1212 parent->etl_right = child;
1215 if (child != ETL_NULLPTR)
1217 child->etl_parent = parent;
1222 template <
typename TLink>
1223 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_right(TLink& parent, TLink* child)
1225 parent.etl_right = child;
1227 if (child != ETL_NULLPTR)
1229 child->etl_parent = &parent;
1234 template <
typename TLink>
1235 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_right(TLink* parent, TLink& child)
1237 if (parent != ETL_NULLPTR)
1239 parent->etl_right = &child;
1242 child.etl_parent = parent;
1249 template <
typename TLink>
1250 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_left(TLink& parent, TLink& child)
1252 TLink* grandparent = parent.etl_parent;
1254 parent.etl_right = child.etl_left;
1256 if (parent.etl_right != ETL_NULLPTR)
1258 parent.etl_right->etl_parent = &parent;
1261 child.etl_parent = grandparent;
1262 parent.etl_parent = &child;
1263 child.etl_left = &parent;
1265 if (grandparent != ETL_NULLPTR)
1267 if (grandparent->etl_left == &parent)
1269 grandparent->etl_left = &child;
1271 else if (grandparent->etl_right == &parent)
1273 grandparent->etl_right = &child;
1280 template <
typename TLink>
1281 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_left(TLink* parent, TLink* child)
1283 if ((parent != ETL_NULLPTR) && (child != ETL_NULLPTR))
1285 link_rotate_left(*parent, *child);
1291 template <
typename TLink>
1292 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_left(TLink& parent, TLink* child)
1294 if (child != ETL_NULLPTR)
1296 link_rotate_left(parent, *child);
1302 template <
typename TLink>
1303 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_left(TLink* parent, TLink& child)
1305 if (parent != ETL_NULLPTR)
1307 link_rotate_left(*parent, child);
1314 template <
typename TLink>
1315 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_right(TLink& parent, TLink& child)
1317 TLink* grandparent = parent.etl_parent;
1319 parent.etl_left = child.etl_right;
1321 if (parent.etl_left != ETL_NULLPTR)
1323 parent.etl_left->etl_parent = &parent;
1326 child.etl_parent = grandparent;
1327 parent.etl_parent = &child;
1328 child.etl_right = &parent;
1330 if (grandparent != ETL_NULLPTR)
1332 if (grandparent->etl_left == &parent)
1334 grandparent->etl_left = &child;
1336 else if (grandparent->etl_right == &parent)
1338 grandparent->etl_right = &child;
1343 template <
typename TLink>
1344 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_right(TLink* parent, TLink* child)
1346 if ((parent != ETL_NULLPTR) && (child != ETL_NULLPTR))
1348 link_rotate_right(*parent, *child);
1352 template <
typename TLink>
1353 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_right(TLink& parent, TLink* child)
1355 if (child != ETL_NULLPTR)
1357 link_rotate_right(parent, *child);
1362 template <
typename TLink>
1363 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_rotate_right(TLink* parent, TLink& child)
1365 if (parent != ETL_NULLPTR)
1367 link_rotate_right(*parent, child);
1376 template <
typename TLink>
1377 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_rotate(TLink& parent, TLink& child)
1379 if (parent.etl_left == &child)
1381 etl::link_rotate_right(parent, child);
1385 etl::link_rotate_left(parent, child);
1392 template <
typename TLink>
1393 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_rotate(TLink* parent, TLink* child)
1395 if ((parent != ETL_NULLPTR) && (child != ETL_NULLPTR))
1397 if (parent->etl_left == child)
1399 etl::link_rotate_right(*parent, *child);
1403 etl::link_rotate_left(*parent, *child);
1411 template <
typename TLink>
1412 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_rotate(TLink& parent, TLink* child)
1414 if (child != ETL_NULLPTR)
1416 if (parent.etl_left == child)
1418 etl::link_rotate_right(parent, *child);
1422 etl::link_rotate_left(parent, *child);
1430 template <
typename TLink>
1431 typename etl::enable_if<etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_rotate(TLink* parent, TLink& child)
1433 if (parent != ETL_NULLPTR)
1435 if (parent->etl_left == &child)
1437 etl::link_rotate_right(*parent, child);
1441 etl::link_rotate_left(*parent, child);
1447 template <
typename TLink>
1448 typename etl::enable_if< etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>
::type link_clear(TLink& node)
1454 template <
typename TLink>
1455 typename etl::enable_if< etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
void>::type link_clear(TLink* node)
1461 template <
typename TLink>
1462 typename etl::enable_if< etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
bool>::type is_linked(TLink& node)
1464 return node.is_linked();
1468 template <
typename TLink>
1469 typename etl::enable_if< etl::is_same<TLink, etl::tree_link<TLink::ID> >::value,
bool>::type is_linked(TLink* node)
1471 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
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:1377
Definition intrusive_links.h:625
Definition intrusive_links.h:164
Definition intrusive_links.h:1131