Template Class node_list

Inheritance Relationships

Base Type

  • public basic_node_list

Class Documentation

template<typename T = node>
class node_list : public basic_node_list

An abstract base class for lists of type T.

This base class should offer all methods required for a SequenceContainer.

This class is not exported.

Note that this class can act as a real container, which stores data, or it can act as a view on another node_list optionally changing what is made visible.

An element derives from node_list<element>, so it exposes access to all its children of type element. However, since node_lists store pointers to nodes, the list can contain more than just element nodes. To access these other nodes you can use a node_list<node> constructed with an element as parameter. This node_list<node> will expose all nodes in the element.

Template Parameters

T – The type of node contained, either element, attribute or node

Public Types

using value_type = T
using allocator_type = std::allocator<value_type>
using size_type = size_t
using difference_type = std::ptrdiff_t
using reference = value_type&
using const_reference = const value_type&
using pointer = value_type*
using const_pointer = const value_type*
using iterator = iterator_impl<value_type>

The iterator class.

using const_iterator = iterator_impl<const value_type>

The const iterator class.

Public Functions

node_list(element_container *e)

Construct a new node list for an element_container e.

Parameters

e – The element_container

inline iterator begin()
inline iterator end()
inline const_iterator cbegin()
inline const_iterator cend()
inline const_iterator begin() const
inline const_iterator end() const
inline value_type &front()
inline const value_type &front() const
inline value_type &back()
inline const value_type &back() const
inline size_t size() const

The size of the visible items.

Returns

The count of items visible

inline bool empty() const
inline explicit operator bool() const
inline iterator insert(const_iterator pos, const value_type &e)

insert a copy of e

inline iterator insert(const_iterator pos, value_type &&e)

insert a copy of e at position pos, moving its data

template<typename... Args> inline or std::is_same_v< value_type, element > iterator insert (const_iterator p, Args &&...args)
inline iterator insert(const_iterator pos, size_t count, const value_type &n)
template<typename InputIter>
inline iterator insert(const_iterator pos, InputIter first, InputIter last)

insert copies of the nodes from first to last at position pos

inline iterator insert(const_iterator pos, std::initializer_list<value_type> nodes)

insert copies of the nodes in nodes at position pos

template<typename InputIter>
inline void assign(InputIter first, InputIter last)

replace content with copies of the nodes from first to last

template<typename... Args> inline or std::is_same_v< value_type, element > or std::is_base_of_v< node, std::remove_cvref_t< Args >... > iterator emplace (const_iterator p, Args &&...args)

emplace an element at position p using arguments args

template<typename... Args> inline or std::is_same_v< value_type, element > or std::is_base_of_v< node, std::remove_cvref_t< Args >... > iterator emplace_front (Args &&...args)

emplace an element at the front using arguments args

template<typename... Args> inline or std::is_same_v< value_type, element > or std::is_base_of_v< node, std::remove_cvref_t< Args >... > iterator emplace_back (Args &&...args)

emplace an element at the back using arguments args

inline iterator erase(const_iterator pos)

erase the node at pos

inline iterator erase(iterator first, iterator last)

erase the nodes from first to last

inline void pop_front()

erase the first node

inline void pop_back()

erase the last node

inline void push_front(value_type &&e)

move the value_type e to the front of this value_type.

inline void push_front(const value_type &e)

copy the value_type e to the front of this value_type.

inline void push_back(value_type &&e)

move the value_type e to the back of this value_type.

inline void push_back(const value_type &e)

copy the value_type e to the back of this value_type.

template<typename Pred>
void sort(Pred &&pred)

Sort the nodes.

Protected Functions

inline node *insert_impl(const_iterator pos, node *n)
inline node *erase_impl(iterator pos)