97 return a.prev == b.prev && a.next == b.next;
123template <
typename NodeType,
typename ListType>
129 constexpr std::ptrdiff_t
offset()
const {
130 return reinterpret_cast<std::ptrdiff_t
>(
131 &(
static_cast<NodeType
const volatile*
>(NULL)->*
_node_ptr)
135 static constexpr bool is_const = std::is_const<ListType>::value;
139 using value_type = std::conditional_t<is_const, const NodeType, NodeType>;
140 using pointer = std::conditional_t<is_const, const NodeType*, NodeType*>;
141 using reference = std::conditional_t<is_const, const NodeType&, NodeType&>;
151 using char_pointer = std::conditional_t<is_const, const char*, char*>;
152 return *
reinterpret_cast<pointer>(
201template <
typename NodeType>
207template <
typename NodeType>
210template <
typename NodeType,
typename ListType>
212 :
public std::reverse_iterator<list_iterator_base<NodeType, ListType>>
214 using iterator = std::reverse_iterator<list_iterator_base<NodeType, ListType>>;
215 using inner_iterator =
typename iterator::iterator_type;
218 : iterator {++inner_iterator{
list, node_ptr}} {}
221 : iterator{other.base()} {}
253 typename ConstIterator
260 static_assert(std::is_standard_layout<NodeType>::value,
261 "list can only iterate standard layout types");
358template <
typename NodeType>
362 list_const_iterator<NodeType>,
363 list_const_iterator<NodeType>
381template <
typename NodeType>
385 list_iterator<NodeType>,
386 list_const_iterator<NodeType>
404 template <
typename IteratorType>
435template <
typename NodeType>
438 return ::vlc::list<NodeType>{
list, node_ptr};
452template <
typename NodeType>
455 return ::vlc::const_list<NodeType>{
list, node_ptr};
Wrapper around any type matching with vlc_list, exposing C++ iterator operations.
Definition vlc_list.hpp:256
ListType & _list
Definition vlc_list.hpp:264
std::conditional_t< is_reverse, list_reverse_iterator< NodeType, ListType >, list_iterator_base< NodeType, ListType > > reverse_iterator
Definition vlc_list.hpp:280
static bool constexpr is_reverse
Definition vlc_list.hpp:267
std::conditional_t< is_reverse, list_reverse_iterator< NodeType, const ListType >, list_iterator_base< NodeType, const ListType > > const_reverse_iterator
Definition vlc_list.hpp:283
friend bool operator==(const list_type &a, const list_type &b)
Definition vlc_list.hpp:333
bool empty() const
Definition vlc_list.hpp:343
iterator end() const
Definition vlc_list.hpp:298
const_reverse_iterator crend() const
Definition vlc_list.hpp:328
list_base(ListType &list, vlc_list NodeType::*node_ptr)
Definition vlc_list.hpp:271
reverse_list as_reverse()
Definition vlc_list.hpp:288
iterator begin() const
Definition vlc_list.hpp:293
friend bool operator!=(const list_type &a, const list_type &b)
Definition vlc_list.hpp:338
reverse_iterator rbegin()
Definition vlc_list.hpp:313
const_iterator cbegin() const
Definition vlc_list.hpp:303
Iterator iterator
Definition vlc_list.hpp:276
ConstIterator const_iterator
Definition vlc_list.hpp:277
const_reverse_iterator crbegin() const
Definition vlc_list.hpp:323
reverse_iterator rend()
Definition vlc_list.hpp:318
vlc_list NodeType::* _node_ptr
Definition vlc_list.hpp:265
const_iterator cend() const
Definition vlc_list.hpp:308
Base class for iterators on the vlc::list's vlc_list wrapper.
Definition vlc_list.hpp:124
constexpr std::ptrdiff_t offset() const
Definition vlc_list.hpp:129
std::conditional_t< is_const, const NodeType *, NodeType * > pointer
Definition vlc_list.hpp:140
ListType * _prev
Definition vlc_list.hpp:126
std::conditional_t< is_const, const NodeType &, NodeType & > reference
Definition vlc_list.hpp:141
vlc_list NodeType::* _node_ptr
Definition vlc_list.hpp:127
friend bool operator!=(const iterator_type &a, const iterator_type &b)
Definition vlc_list.hpp:192
static constexpr bool is_const
Definition vlc_list.hpp:135
friend bool operator==(const iterator_type &a, const iterator_type &b)
Definition vlc_list.hpp:187
std::conditional_t< is_const, const NodeType, NodeType > value_type
Definition vlc_list.hpp:139
std::bidirectional_iterator_tag iterator_category
Definition vlc_list.hpp:138
iterator_type & operator--()
Definition vlc_list.hpp:174
reference operator*() const
Definition vlc_list.hpp:149
list_iterator_base(ListType &list, vlc_list NodeType::*node_ptr)
Definition vlc_list.hpp:146
std::ptrdiff_t difference_type
Definition vlc_list.hpp:142
iterator_type operator--(int)
Definition vlc_list.hpp:182
ListType * _next
Definition vlc_list.hpp:126
iterator_type operator++(int)
Definition vlc_list.hpp:169
iterator_type operator++()
Definition vlc_list.hpp:161
pointer operator->() const
Definition vlc_list.hpp:156
ListType * _current
Definition vlc_list.hpp:126
Definition vlc_list.hpp:213
list_reverse_iterator(iterator other)
Definition vlc_list.hpp:220
list_reverse_iterator(ListType &list, vlc_list NodeType::*node_ptr)
Definition vlc_list.hpp:217
struct vlc_param ** list
Definition core.c:402
bool operator==(const ::vlc_list &a, const ::vlc_list &b)
Compare two vlc_list node and check whether they represent the same element.
Definition vlc_list.hpp:95
bool operator!=(const ::vlc_list &a, const ::vlc_list &b)
Compare two vlc_list node and check whether they representthe same element.
Definition vlc_list.hpp:110
::vlc::list< NodeType > from(vlc_list &list, vlc_list NodeType::*node_ptr)
Construct a vlc::list (mutable list) object from a mutable vlc_list reference.
Definition vlc_list.hpp:436
static void vlc_list_append(struct vlc_list *restrict node, struct vlc_list *head)
Appends an element into a list.
Definition vlc_list.h:110
static void vlc_list_prepend(struct vlc_list *restrict node, struct vlc_list *head)
Prepends an element into a list.
Definition vlc_list.h:122
static bool vlc_list_is_empty(const struct vlc_list *head)
Checks if a list is empty.
Definition vlc_list.h:167
static void vlc_list_remove(struct vlc_list *restrict node)
Removes an element from a list.
Definition vlc_list.h:135
Definition vlc_cxx_helpers.hpp:46
Public type-safe wrapper around const vlc_list, providing const iterator and iteration functions.
Definition vlc_list.hpp:364
const_list(const vlc_list &l, vlc_list NodeType::*node_ptr)
Definition vlc_list.hpp:369
Public type-safe wrapper around mutable vlc_list, providing iterators, iteration functions and mutati...
Definition vlc_list.hpp:387
void push_back(NodeType &item)
Definition vlc_list.hpp:417
IteratorType erase(IteratorType it)
Definition vlc_list.hpp:405
list(vlc_list &l, vlc_list NodeType::*node_ptr)
Construct a vlc::list from an existing vlc_list.
Definition vlc_list.hpp:399
void push_front(NodeType &item)
Definition vlc_list.hpp:411
Doubly-linked list node.
Definition vlc_list.h:44
This provides convenience helpers for linked lists.