{"data":{"post":{"title":"A Study of LLVM ADT: ilist, iplist and simple_ilist","subtitle":"","isPublished":true,"createdTime":"2023-01-15T00:00:00.000Z","lastModifiedTime":null,"license":null,"tags":["LLVM","ADT","C++"],"category":"Programming","file":{"childMdx":{"excerpt":"Introduction ilist  is an intrusive double-linked list -- which means that each linked node stores…","code":{"body":"function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nconst layoutProps = {};\nreturn class MDXContent extends React.Component {\n  constructor(props) {\n    super(props);\n    this.layout = null;\n  }\n\n  render() {\n    const _this$props = this.props,\n          {\n      components\n    } = _this$props,\n          props = _objectWithoutProperties(_this$props, [\"components\"]);\n\n    return React.createElement(MDXTag, {\n      name: \"wrapper\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"h2\",\n      components: components\n    }, `Introduction`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist`), ` is an intrusive double-linked list -- which means that each linked node stores its data and the node pointers in the same structure. There is no such kind of linked-list implemented containers shipped with the C++ standard library.`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `iplist`), ` is a purely intrusive list. Currently, `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist`), ` delegates its implementation to `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `iplist`), ` with `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `using`), ` grammar.`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `simple_ilist`), ` is a simple intrusive list implementation that never takes ownership of anything inserted in it. Moreover, unlike `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `iplist`), ` and `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist`), `, a `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `simple_ilist`), ` never deletes values and has no callback traits.`), React.createElement(MDXTag, {\n      name: \"h2\",\n      components: components\n    }, `Key Features`), React.createElement(MDXTag, {\n      name: \"h3\",\n      components: components\n    }, `Intrusiveness`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, `Unlike C++ standard library containers not require their elements to inherit a base class, `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `iplist`), ` and its derived classes require their nodes to inherit `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist_node`), `.`), React.createElement(MDXTag, {\n      name: \"blockquote\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"p\",\n      components: components,\n      parentName: \"blockquote\"\n    }, `Privately inherited classes shall friend `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `llvm::ilist_detail::NodeAccess`), `.`)), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist_node`), ` eventually inherits `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist_node_base<bool>`), ` which contains the `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `Prev`), ` and `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `Next`), ` pointer that points to the previous node and the next node.`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, `This makes the data carried by the node class get laid out right below the previous node pointer and the next node pointer of its superclass - `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist_node`), `. This is what we called an intrusive list.`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, `At the same time, if you want to override the standard behaviors of the containing intrusive list do against the node class which includes deleting a node, adding a node to the list, removing a node from the list and moving a node from one list to another, you can also offer traits of `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist_node`), ` as a template argument of the list.`), React.createElement(MDXTag, {\n      name: \"pre\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"code\",\n      components: components,\n      parentName: \"pre\",\n      props: {\n        \"className\": \"language-cpp\"\n      }\n    }, `template <typename NodeTy>\nstruct ilist_alloc_traits {\n  static void deleteNode(NodeTy *V);\n};\ntemplate <typename NodeTy>\nstruct ilist_noalloc_traits {\n  static void deleteNode(NodeTy *V);\n};\n`)), React.createElement(MDXTag, {\n      name: \"pre\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"code\",\n      components: components,\n      parentName: \"pre\",\n      props: {\n        \"className\": \"language-cpp\"\n      }\n    }, `template <typename NodeTy>\nstruct ilist_callback_traits {\n  void addNodeToList(NodeTy *);\n  void removeNodeFromList(NodeTy *);\n  template <class Iterator>\n  void transferNodesFromList(ilist_callback_traits &OldList, Iterator /*first*/, Iterator /*last*/);\n};\n`)), React.createElement(MDXTag, {\n      name: \"pre\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"code\",\n      components: components,\n      parentName: \"pre\",\n      props: {\n        \"className\": \"language-cpp\"\n      }\n    }, `template <typename NodeTy>\nstruct ilist_node_traits :\n  ilist_alloc_traits<NodeTy>,\n  ilist_callback_traits<NodeTy> {};\n`)), React.createElement(MDXTag, {\n      name: \"h3\",\n      components: components\n    }, `Sentinel Tracking`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, `User code can check if an `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist_node`), ` is a sentinel at runtime by checking the result of `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `bool ilist_node::isSentinel() const`), `.`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, `If an `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist_node`), ` derived class didn't instantiate the templated class `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist_node`), ` with template argument `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist_sentinel_tracking<true>`), `, there would be a `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `static_assert`), ` come up at compile time.`), React.createElement(MDXTag, {\n      name: \"pre\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"code\",\n      components: components,\n      parentName: \"pre\",\n      props: {\n        \"className\": \"language-cpp\"\n      }\n    }, `// ilist_node publicly inherits ilist_node_impl\nclass ilist_node_impl {\n\npublic:\n\n  /// Check whether this is the sentinel node.\n  ///\n  /// This requires sentinel tracking to be explicitly enabled. Use the\n  /// ilist_sentinel_tracking<true> option to get this API.\n  bool isSentinel() const {\n    static_assert(OptionsT::is_sentinel_tracking_explicit, \"Use ilist_sentinel_tracking<true> to enable isSentinel()\");\n    return node_base_type::isSentinel();\n  }\n\n}\n`)), React.createElement(MDXTag, {\n      name: \"h3\",\n      components: components\n    }, `Tagging`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, `Since there is only one pair of node pointers on an `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist_node`), `-inherited class, we can imply that instances of such a class are only able to be added to one intrusive list at one time. But with `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist_tag`), `, a node can be stored in multiple LLVM intrusive lists.`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, `Here is an example in LLVM's doc:`), React.createElement(MDXTag, {\n      name: \"pre\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"code\",\n      components: components,\n      parentName: \"pre\",\n      props: {\n        \"className\": \"language-cpp\"\n      }\n    }, `struct A {};\nstruct B {};\nstruct N : ilist_node<N, ilist_tag<A>>, ilist_node<N, ilist_tag<B>> {};\n\nvoid foo() {\n  simple_ilist<N, ilist_tag<A>> ListA;\n  simple_ilist<N, ilist_tag<B>> ListB;\n  N N1;\n  ListA.push_back(N1);\n  ListB.push_back(N1);\n}\n`)), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, `This is because, for `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist_node`), ` subclasses, multiple inheritances of \\`ilist_node`, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, ``), ` gives the node multiple pair of node pointers.`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, `Then for `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `simple_ilist<NodeTy, ilist_tag<TagTy>>`), `, the implementation of intrusive list's ultimate content managing interfaces manipulate the node by casting it into `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `node_pointer`), ` which eventually interpreted into `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `ilist_node_impl<ilist_detail::node_options<NodeTy, false, false, ilist_tag<TagTy>>>`), `.`), React.createElement(MDXTag, {\n      name: \"pre\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"code\",\n      components: components,\n      parentName: \"pre\",\n      props: {\n        \"className\": \"language-cpp\"\n      }\n    }, `template <class OptionsT>\nstruct IteratorTraits<OptionsT, false> {\n  using node_pointer = ilist_node_impl<OptionsT> *;\n};\n\ntemplate <class OptionsT, bool IsReverse, bool IsConst>\nclass ilist_iterator {  \n  using Traits = ilist_detail::IteratorTraits<OptionsT, IsConst>;\nprivate:\n  // node_pointer eventually interpreted as:\n  // ilist_node_impl<\n  //   ilist_detail::node_options<\n  //     NodeTy,\n  //     false,\n  //     false,\n  //     ilist_tag<TagTy>\n  //   >\n  // > *\n  using node_pointer = typename Traits::node_pointer;\n\n  node_pointer NodePtr = nullptr;\n}\n\ntemplate <typename T, class... Options>\nclass simple_ilist: ... {\n  // For simple_ilist<NodeTy, ilist_tag<TagTy>>\n  // OptionsT eventually interpreted as:\n  // ilist_detail::node_options<NodeTy, false, false, ilist_tag<TagTy>>\n  using OptionsT = typename ilist_detail::compute_node_options<T, Options...>::type;\npublic:\n  using iterator = ilist_iterator<OptionsT, false, false>;\n}\n`)), React.createElement(MDXTag, {\n      name: \"h2\",\n      components: components\n    }, `List Interface`), React.createElement(MDXTag, {\n      name: \"h3\",\n      components: components\n    }, `Accessing Basic Properties`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `base_list_type`), React.createElement(MDXTag, {\n      name: \"sup\",\n      components: components,\n      parentName: \"p\",\n      props: {\n        \"id\": \"fnref-1\"\n      }\n    }, React.createElement(MDXTag, {\n      name: \"a\",\n      components: components,\n      parentName: \"sup\",\n      props: {\n        \"href\": \"#fn-1\",\n        \"className\": \"footnote-ref\"\n      }\n    }, `1`)), ` inherited interface:`), React.createElement(MDXTag, {\n      name: \"ul\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `size`), ` brought by `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `using base_list_type::size;`))), React.createElement(MDXTag, {\n      name: \"h3\",\n      components: components\n    }, `Managing Contents`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `iplist_impl`), ` inherited interface:`), React.createElement(MDXTag, {\n      name: \"ul\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void swap(iplist_impl&)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `iterator insert(iterator, pointer)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `iterator insert(iterator, const_reference)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `iterator insertAfter(iterator, pointer)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `pointer remove(const iterator&)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `pointer remove(pointer)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `pointer remove(reference)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `iterator erase(iterator)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void clear()`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void push_front(pointer)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void push_back(pointer)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void pop_front()`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void pop_back()`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void insert<InIt>(iterator where, InIt first, InIt last)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void splice<InIt>(iterator, iplist_impl&)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void splice<InIt>(iterator, iplist_impl&, iterator first)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void splice<InIt>(iterator, iplist_impl&, iterator first, iterator last)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void splice<InIt>(iterator, iplist_impl&, reference)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void splice<InIt>(iterator, iplist_impl&, pointer)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void merge<Compare>(iplist_impl&, Compare)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void merge(iplist_impl&)`))), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `base_list_type`), React.createElement(MDXTag, {\n      name: \"sup\",\n      components: components,\n      parentName: \"p\",\n      props: {\n        \"id\": \"fnref-1\"\n      }\n    }, React.createElement(MDXTag, {\n      name: \"a\",\n      components: components,\n      parentName: \"sup\",\n      props: {\n        \"href\": \"#fn-1\",\n        \"className\": \"footnote-ref\"\n      }\n    }, `1`)), ` inherited interface:`), React.createElement(MDXTag, {\n      name: \"ul\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `sort`), ` brought by `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `using base_list_type::sort;`))), React.createElement(MDXTag, {\n      name: \"h3\",\n      components: components\n    }, `Iterators`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `base_list_type`), React.createElement(MDXTag, {\n      name: \"sup\",\n      components: components,\n      parentName: \"p\",\n      props: {\n        \"id\": \"fnref-1\"\n      }\n    }, React.createElement(MDXTag, {\n      name: \"a\",\n      components: components,\n      parentName: \"sup\",\n      props: {\n        \"href\": \"#fn-1\",\n        \"className\": \"footnote-ref\"\n      }\n    }, `1`)), ` inherited interface:`), React.createElement(MDXTag, {\n      name: \"ul\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `begin`), ` brought by `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `using base_list_type::begin;`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `end`), ` brought by `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `using base_list_type::end;`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `rbegin`), ` brought by `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `using base_list_type::rbegin;`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `rend`), ` brought by `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `using base_list_type::rend;`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `empty`), ` brought by `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `using base_list_type::empty;`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `front`), ` brought by `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `using base_list_type::front;`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `back`), ` brought by `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `using base_list_type::back;`))), React.createElement(MDXTag, {\n      name: \"h2\",\n      components: components\n    }, `Node Interface`), React.createElement(MDXTag, {\n      name: \"h3\",\n      components: components\n    }, `Managing Pointers`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `base_node_type`), React.createElement(MDXTag, {\n      name: \"sup\",\n      components: components,\n      parentName: \"p\",\n      props: {\n        \"id\": \"fnref-2\"\n      }\n    }, React.createElement(MDXTag, {\n      name: \"a\",\n      components: components,\n      parentName: \"sup\",\n      props: {\n        \"href\": \"#fn-2\",\n        \"className\": \"footnote-ref\"\n      }\n    }, `2`)), ` inherited interface:`), React.createElement(MDXTag, {\n      name: \"ul\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void setPrev(ilist_node_base *)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void setNext(ilist_node_base *)`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `ilist_node_base *getPrev() const`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `ilist_node_base *getNext() const`))), React.createElement(MDXTag, {\n      name: \"h3\",\n      components: components\n    }, `Sentinel`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `node_base_type`), ` inherited interface:`), React.createElement(MDXTag, {\n      name: \"ul\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `bool isSentinel const`), React.createElement(MDXTag, {\n      name: \"sup\",\n      components: components,\n      parentName: \"li\",\n      props: {\n        \"id\": \"fnref-3\"\n      }\n    }, React.createElement(MDXTag, {\n      name: \"a\",\n      components: components,\n      parentName: \"sup\",\n      props: {\n        \"href\": \"#fn-3\",\n        \"className\": \"footnote-ref\"\n      }\n    }, `3`)), ` ?`), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `bool isKnownSentinel() const`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `void initializeSentinel()`))), React.createElement(MDXTag, {\n      name: \"h2\",\n      components: components\n    }, `Intrusive List Classes`), React.createElement(MDXTag, {\n      name: \"ul\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `iplist`), React.createElement(MDXTag, {\n      name: \"ul\",\n      components: components,\n      parentName: \"li\"\n    }, React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `ilist`)))), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `simple_ilist`))), React.createElement(MDXTag, {\n      name: \"h2\",\n      components: components\n    }, `Source Files`), React.createElement(MDXTag, {\n      name: \"ul\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `include/llvm/ADT/ilist_base.h`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `include/llvm/ADT/ilist_iterator.h`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `include/llvm/ADT/ilist_node_base.h`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `include/llvm/ADT/ilist_node_options.h`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `include/llvm/ADT/ilist_node.h`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `include/llvm/ADT/ilist.h`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ul\"\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `include/llvm/ADT/simple_ilist.h`))), React.createElement(MDXTag, {\n      name: \"div\",\n      components: components,\n      props: {\n        \"className\": \"footnotes\"\n      }\n    }, React.createElement(MDXTag, {\n      name: \"hr\",\n      components: components,\n      parentName: \"div\"\n    }), React.createElement(MDXTag, {\n      name: \"ol\",\n      components: components,\n      parentName: \"div\"\n    }, React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ol\",\n      props: {\n        \"id\": \"fn-1\"\n      }\n    }, `This type alias usually gets ineterpreted into a `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `ilist_base<bool enable_sentinel_tracking>`), ` class such as `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `simple_ilist`), `.`, React.createElement(MDXTag, {\n      name: \"a\",\n      components: components,\n      parentName: \"li\",\n      props: {\n        \"href\": \"#fnref-1\",\n        \"className\": \"footnote-backref\"\n      }\n    }, `↩`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ol\",\n      props: {\n        \"id\": \"fn-2\"\n      }\n    }, `This type alias usually gets ineterpreted into `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `ilst_node_base<bool enable_sentinel_tracking>`), `.`, React.createElement(MDXTag, {\n      name: \"a\",\n      components: components,\n      parentName: \"li\",\n      props: {\n        \"href\": \"#fnref-2\",\n        \"className\": \"footnote-backref\"\n      }\n    }, `↩`)), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ol\",\n      props: {\n        \"id\": \"fn-3\"\n      }\n    }, `This method is missing for derived classes of `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `ilist_node_base<false>`), `.`, React.createElement(MDXTag, {\n      name: \"a\",\n      components: components,\n      parentName: \"li\",\n      props: {\n        \"href\": \"#fnref-3\",\n        \"className\": \"footnote-backref\"\n      }\n    }, `↩`)))));\n  }\n\n}\nMDXContent.isMDXComponent = true;","scope":""},"headings":[{"value":"Introduction","depth":2},{"value":"Key Features","depth":2},{"value":"Intrusiveness","depth":3},{"value":"Sentinel Tracking","depth":3},{"value":"Tagging","depth":3},{"value":"List Interface","depth":2},{"value":"Accessing Basic Properties","depth":3},{"value":"Managing Contents","depth":3},{"value":"Iterators","depth":3},{"value":"Node Interface","depth":2},{"value":"Managing Pointers","depth":3},{"value":"Sentinel","depth":3},{"value":"Intrusive List Classes","depth":2},{"value":"Source Files","depth":2}]}}},"earlierPostExcerpt":{"slug":"/post/2022/08/using-functional-binding-to-observe-in-swiftui-19a8","title":"Using Functional Binding to Observe in SwiftUI","subtitle":"","createdTime":"2022-08-19T00:00:00.000Z","tags":["SwiftUI","Binding","Swift","Observer"],"category":"Programming","file":{"childMdx":{"excerpt":"Story This week, my colleague asked me a question: how to observe user selection\nbehaviors on SwiftUI's  Picker ? This is a question came from real bussiness. Thus I think it worth to take\nme time to solve it. The example code is as shown below and my colleague wanted to observe user's\nbehaviors on…"}}},"laterPostExcerpt":{"slug":"/post/2023/03/adapting-reference-semantics-model-in-swiftui-the-basics-f521","title":"Adapting Reference Semantics Model in SwiftUI - The Basics","subtitle":"","createdTime":"2023-03-02T00:00:00.000Z","tags":["SwiftUI","Swift","Adaptor","Reference Semantics","Binding"],"category":"Programming","file":{"childMdx":{"excerpt":"Introduction Recently, one of my colleagues had been struggling with porting reference semantics model to SwiftUI with  ObservableObject  and  @StateObject . In this post, since there are many examples talked about porting reference semantics models to SwiftUI this way on the Internet, I'm not going…"}}}},"pageContext":{"postId":"644e5f5d-bcdf-5700-9877-34088a7af8e8","earlierPostId":"e1149583-4058-5dd4-8fc3-25534469b2b2","laterPostId":"e508707d-f31e-5d24-b1ac-2b6a1b6155fc"}}