VLC 4.0.0-dev
Loading...
Searching...
No Matches
vlc::list_base< NodeType, ListType, Iterator, ConstIterator > Class Template Reference

Wrapper around any type matching with vlc_list, exposing C++ iterator operations. More...

#include <vlc_list.hpp>

Inheritance diagram for vlc::list_base< NodeType, ListType, Iterator, ConstIterator >:
[legend]
Collaboration diagram for vlc::list_base< NodeType, ListType, Iterator, ConstIterator >:
[legend]

Public Types

using list_type = list_base< NodeType, ListType, Iterator, ConstIterator >
 
using iterator = Iterator
 
using const_iterator = ConstIterator
 
using reverse_iterator = std::conditional_t< is_reverse, list_reverse_iterator< NodeType, ListType >, list_iterator_base< NodeType, ListType > >
 
using const_reverse_iterator = std::conditional_t< is_reverse, list_reverse_iterator< NodeType, const ListType >, list_iterator_base< NodeType, const ListType > >
 
using reverse_list = list_base< NodeType, ListType, reverse_iterator, const_reverse_iterator >
 

Public Member Functions

 list_base (ListType &list, vlc_list NodeType::*node_ptr)
 
reverse_list as_reverse ()
 
iterator begin () const
 
iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
bool empty () const
 

Protected Attributes

ListType & _list
 
vlc_list NodeType::* _node_ptr
 

Static Protected Attributes

static bool constexpr is_reverse
 

Friends

bool operator== (const list_type &a, const list_type &b)
 
bool operator!= (const list_type &a, const list_type &b)
 

Detailed Description

template<typename NodeType, typename ListType, typename Iterator, typename ConstIterator>
class vlc::list_base< NodeType, ListType, Iterator, ConstIterator >

Wrapper around any type matching with vlc_list, exposing C++ iterator operations.

Users should use the vlc::list and vlc::const_list types instead, and initialize them from the vlc::from function.

struct item {
// ...
vlc_list node;
}
struct vlc_list c_list;
vlc_list_init(&c_list);
// ...
auto list = vlc::from(&list, &item::node);
::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_init(struct vlc_list *restrict head)
Initializes an empty list head.
Definition vlc_list.h:57
Public type-safe wrapper around mutable vlc_list, providing iterators, iteration functions and mutati...
Definition vlc_list.hpp:387
Doubly-linked list node.
Definition vlc_list.h:44
Template Parameters
NodeTypethe type of each node from the list
ListTypeeither vlc_list or const vlc_list
Iteratorthe iterator type returned by vlc::list_base::begin() and vlc::list_base::end()
ConstIteratorthe iterator type returned by vlc::list_base::cbegin() and vlc::list_base::cend()

Member Typedef Documentation

◆ const_iterator

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
using vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::const_iterator = ConstIterator

◆ const_reverse_iterator

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
using vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::const_reverse_iterator = std::conditional_t<is_reverse, list_reverse_iterator<NodeType, const ListType>, list_iterator_base<NodeType, const ListType> >

◆ iterator

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
using vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::iterator = Iterator

◆ list_type

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
using vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::list_type = list_base<NodeType, ListType, Iterator, ConstIterator>

◆ reverse_iterator

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
using vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::reverse_iterator = std::conditional_t<is_reverse, list_reverse_iterator<NodeType, ListType>, list_iterator_base<NodeType, ListType> >

◆ reverse_list

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
using vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::reverse_list = list_base<NodeType, ListType, reverse_iterator, const_reverse_iterator>

Constructor & Destructor Documentation

◆ list_base()

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::list_base ( ListType &  list,
vlc_list NodeType::*  node_ptr 
)
inline

Member Function Documentation

◆ as_reverse()

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
reverse_list vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::as_reverse ( )
inline

◆ begin()

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
iterator vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::begin ( ) const
inline

◆ cbegin()

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
const_iterator vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::cbegin ( ) const
inline

◆ cend()

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
const_iterator vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::cend ( ) const
inline

◆ crbegin()

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
const_reverse_iterator vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::crbegin ( ) const
inline

◆ crend()

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
const_reverse_iterator vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::crend ( ) const
inline

◆ empty()

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
bool vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::empty ( ) const
inline

◆ end()

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
iterator vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::end ( ) const
inline

◆ rbegin()

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
reverse_iterator vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::rbegin ( )
inline

◆ rend()

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
reverse_iterator vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::rend ( )
inline

Friends And Related Symbol Documentation

◆ operator!=

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
bool operator!= ( const list_type a,
const list_type b 
)
friend

◆ operator==

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
bool operator== ( const list_type a,
const list_type b 
)
friend

Field Documentation

◆ _list

◆ _node_ptr

◆ is_reverse

template<typename NodeType , typename ListType , typename Iterator , typename ConstIterator >
bool constexpr vlc::list_base< NodeType, ListType, Iterator, ConstIterator >::is_reverse
staticconstexprprotected
Initial value:
= !std::is_same<
Iterator, list_reverse_iterator<NodeType, ListType>>::value

The documentation for this class was generated from the following file: