SheafSystem  0.0.0.0
sheaf::singly_linked_list< T, A > Class Template Reference

Wrapper class for forward_list or slist depending on compiler. The class replicates the minimum subset of the forward_list and slist classes. It also implements a push_front function that takes a range. More...

#include <singly_linked_list.h>

Public Types

typedef list_ns::forward_list< T, A >::value_type value_type
 
typedef list_ns::forward_list< T, A >::size_type size_type
 
typedef list_ns::forward_list< T, A >::difference_type difference_type
 
typedef list_ns::forward_list< T, A >::reference reference
 
typedef list_ns::forward_list< T, A >::const_reference const_reference
 
typedef list_ns::forward_list< T, A >::pointer pointer
 
typedef list_ns::forward_list< T, A >::iterator iterator
 
typedef list_ns::forward_list< T, A >::const_iterator const_iterator
 

Public Member Functions

 singly_linked_list ()
 Default Constructor. More...
 
 singly_linked_list (size_type count)
 Constructs the container with count value-initialized (default constructed, for classes) instances of T. No copies are made. More...
 
 singly_linked_list (size_type count, const T &value)
 Constructs the container with count copies of elements with value value. More...
 
 singly_linked_list (const singly_linked_list &other)
 Copy Constructor. More...
 
 ~singly_linked_list ()
 Destructor. More...
 
singly_linked_listoperator= (const singly_linked_list &other)
 Copy assignment operator. Replaces the contents with a copy of the contents of other. More...
 
singly_linked_listoperator= (singly_linked_list &other)
 Move assignment operator. Replaces the contents with those of other using move semantics (i.e. the data in other is moved from other into this container). other is in a valid but unspecified state afterwards. More...
 
void swap (singly_linked_list &other)
 Echanges the contents of the container with those of other. Does not invoke any move, copy, or swap operations on individual elements. More...
 
reference front ()
 Returns a reference to the first element in the container. More...
 
const_reference front () const
 Returns a reference to the first element in the container. More...
 
iterator begin ()
 Returns an iterator to the first element of the container. More...
 
const_iterator begin () const
 Returns an iterator to the first element of the container. More...
 
iterator end ()
 Returns an iterator to the element following the last element of the container. More...
 
const_iterator end () const
 Returns an iterator to the element following the last element of the container. More...
 
bool empty () const
 Checks if the container has no elements, i.e. whether begin() == end(). More...
 
size_type max_size () const
 Returns the maximum number of elements the container is able to hold due to system or library implementation limitations. More...
 
void clear ()
 Removes all elements from the container. More...
 
iterator insert_after (const_iterator pos, const T &value)
 Inserts value after the element pointed to by pos. More...
 
iterator insert_after (const_iterator pos, T &&value)
 Inserts value after the element pointed to by pos. More...
 
void insert_after (const_iterator pos, size_type count, const T &value)
 Inserts count copies of the value after the element pointed to by pos. More...
 
template<class InputIt >
void insert_after (const_iterator pos, InputIt first, InputIt last)
 inserts elements from range [first, last) after the element pointed to by pos. More...
 
iterator erase_after (const_iterator position)
 Removes the element following pos. More...
 
void push_front (const T &value)
 Prepends the given element value to the beginning of the container. More...
 
void push_front (T &value)
 Prepends the given element value to the beginning of the container. More...
 
template<class InputIt >
void push_front (InputIt first, InputIt last)
 Prepends the range [first, last) to the beginning of the containter. More...
 
void pop_front ()
 Removes the first element of the container. More...
 
void resize (size_type count)
 Resizes the container to contain count elements. Additional value-initialized elements are appended. More...
 
void resize (size_type count, const value_type &value)
 Resizes the container to contain count elements. Additional copies of value are appended. More...
 
void merge (singly_linked_list &other)
 Merges two sorted lists into one. The lists should be sorted into ascending order. More...
 
void remove (const T &value)
 Removes all elements with value. More...
 
void reverse ()
 Reverses the order of the elements in the container. More...
 
void unique ()
 Removes all consecutive duplicate elements from the container. More...
 
void sort ()
 Sorts the elements in ascending order. More...
 

Friends

bool operator== (const singly_linked_list< T, A > &lhs, const singly_linked_list< T, A > &rhs)
 
bool operator (const singly_linked_list< T, A > &lhs, const singly_linked_list< T, A > &rhs)
 

Detailed Description

template<typename T, class A = list_ns::allocator<T>>
class sheaf::singly_linked_list< T, A >

Wrapper class for forward_list or slist depending on compiler. The class replicates the minimum subset of the forward_list and slist classes. It also implements a push_front function that takes a range.

Hack:
This wrapper is a temporary fix until gcc-4.2.2 is no longer supported.

Definition at line 42 of file singly_linked_list.h.

Constructor & Destructor Documentation

◆ singly_linked_list() [1/4]

template<typename T, class A = list_ns::allocator<T>>
sheaf::singly_linked_list< T, A >::singly_linked_list ( )
inline

Default Constructor.

Definition at line 95 of file singly_linked_list.h.

◆ singly_linked_list() [2/4]

template<typename T, class A = list_ns::allocator<T>>
sheaf::singly_linked_list< T, A >::singly_linked_list ( size_type  count)
inline

Constructs the container with count value-initialized (default constructed, for classes) instances of T. No copies are made.

Definition at line 104 of file singly_linked_list.h.

◆ singly_linked_list() [3/4]

template<typename T, class A = list_ns::allocator<T>>
sheaf::singly_linked_list< T, A >::singly_linked_list ( size_type  count,
const T &  value 
)
inline

Constructs the container with count copies of elements with value value.

Definition at line 112 of file singly_linked_list.h.

◆ singly_linked_list() [4/4]

template<typename T, class A = list_ns::allocator<T>>
sheaf::singly_linked_list< T, A >::singly_linked_list ( const singly_linked_list< T, A > &  other)
inline

Copy Constructor.

Definition at line 120 of file singly_linked_list.h.

◆ ~singly_linked_list()

template<typename T, class A = list_ns::allocator<T>>
sheaf::singly_linked_list< T, A >::~singly_linked_list ( )
inline

Destructor.

Definition at line 128 of file singly_linked_list.h.

Member Function Documentation

◆ begin() [1/2]

◆ begin() [2/2]

template<typename T, class A = list_ns::allocator<T>>
const_iterator sheaf::singly_linked_list< T, A >::begin ( ) const
inline

Returns an iterator to the first element of the container.

Definition at line 192 of file singly_linked_list.h.

◆ clear()

template<typename T, class A = list_ns::allocator<T>>
void sheaf::singly_linked_list< T, A >::clear ( )
inline

Removes all elements from the container.

Definition at line 235 of file singly_linked_list.h.

Referenced by fiber_bundle::discretization_iterator::force_is_done().

◆ empty()

template<typename T, class A = list_ns::allocator<T>>
bool sheaf::singly_linked_list< T, A >::empty ( ) const
inline

Checks if the container has no elements, i.e. whether begin() == end().

Definition at line 218 of file singly_linked_list.h.

Referenced by fiber_bundle::discretization_iterator::next().

◆ end() [1/2]

◆ end() [2/2]

template<typename T, class A = list_ns::allocator<T>>
const_iterator sheaf::singly_linked_list< T, A >::end ( ) const
inline

Returns an iterator to the element following the last element of the container.

Definition at line 210 of file singly_linked_list.h.

◆ erase_after()

template<typename T, class A = list_ns::allocator<T>>
iterator sheaf::singly_linked_list< T, A >::erase_after ( const_iterator  position)
inline

Removes the element following pos.

Definition at line 290 of file singly_linked_list.h.

◆ front() [1/2]

template<typename T, class A = list_ns::allocator<T>>
reference sheaf::singly_linked_list< T, A >::front ( )
inline

Returns a reference to the first element in the container.

Definition at line 168 of file singly_linked_list.h.

Referenced by fiber_bundle::discretization_iterator::next().

◆ front() [2/2]

template<typename T, class A = list_ns::allocator<T>>
const_reference sheaf::singly_linked_list< T, A >::front ( ) const
inline

Returns a reference to the first element in the container.

Definition at line 176 of file singly_linked_list.h.

◆ insert_after() [1/4]

template<typename T, class A = list_ns::allocator<T>>
iterator sheaf::singly_linked_list< T, A >::insert_after ( const_iterator  pos,
const T &  value 
)
inline

Inserts value after the element pointed to by pos.

Definition at line 252 of file singly_linked_list.h.

◆ insert_after() [2/4]

template<typename T, class A = list_ns::allocator<T>>
iterator sheaf::singly_linked_list< T, A >::insert_after ( const_iterator  pos,
T &&  value 
)
inline

Inserts value after the element pointed to by pos.

Definition at line 260 of file singly_linked_list.h.

◆ insert_after() [3/4]

template<typename T, class A = list_ns::allocator<T>>
void sheaf::singly_linked_list< T, A >::insert_after ( const_iterator  pos,
size_type  count,
const T &  value 
)
inline

Inserts count copies of the value after the element pointed to by pos.

Definition at line 268 of file singly_linked_list.h.

◆ insert_after() [4/4]

template<typename T, class A = list_ns::allocator<T>>
template<class InputIt >
void sheaf::singly_linked_list< T, A >::insert_after ( const_iterator  pos,
InputIt  first,
InputIt  last 
)
inline

inserts elements from range [first, last) after the element pointed to by pos.

Definition at line 278 of file singly_linked_list.h.

◆ max_size()

template<typename T, class A = list_ns::allocator<T>>
size_type sheaf::singly_linked_list< T, A >::max_size ( ) const
inline

Returns the maximum number of elements the container is able to hold due to system or library implementation limitations.

Definition at line 227 of file singly_linked_list.h.

◆ merge()

template<typename T, class A = list_ns::allocator<T>>
void sheaf::singly_linked_list< T, A >::merge ( singly_linked_list< T, A > &  other)
inline

Merges two sorted lists into one. The lists should be sorted into ascending order.

Definition at line 404 of file singly_linked_list.h.

◆ operator=() [1/2]

template<typename T, class A = list_ns::allocator<T>>
singly_linked_list& sheaf::singly_linked_list< T, A >::operator= ( const singly_linked_list< T, A > &  other)
inline

Copy assignment operator. Replaces the contents with a copy of the contents of other.

Definition at line 136 of file singly_linked_list.h.

◆ operator=() [2/2]

template<typename T, class A = list_ns::allocator<T>>
singly_linked_list& sheaf::singly_linked_list< T, A >::operator= ( singly_linked_list< T, A > &  other)
inline

Move assignment operator. Replaces the contents with those of other using move semantics (i.e. the data in other is moved from other into this container). other is in a valid but unspecified state afterwards.

Definition at line 149 of file singly_linked_list.h.

◆ pop_front()

template<typename T, class A = list_ns::allocator<T>>
void sheaf::singly_linked_list< T, A >::pop_front ( )
inline

Removes the first element of the container.

Definition at line 377 of file singly_linked_list.h.

Referenced by fiber_bundle::discretization_iterator::next().

◆ push_front() [1/3]

template<typename T, class A = list_ns::allocator<T>>
void sheaf::singly_linked_list< T, A >::push_front ( const T &  value)
inline

Prepends the given element value to the beginning of the container.

Definition at line 348 of file singly_linked_list.h.

Referenced by geometry::d_array_point_locator< DC, DB >::box_list(), geometry::d_tree_point_locator_node< DC, DB >::insert_box(), and fiber_bundle::discretization_iterator::next().

◆ push_front() [2/3]

template<typename T, class A = list_ns::allocator<T>>
void sheaf::singly_linked_list< T, A >::push_front ( T &  value)
inline

Prepends the given element value to the beginning of the container.

Definition at line 356 of file singly_linked_list.h.

◆ push_front() [3/3]

template<typename T, class A = list_ns::allocator<T>>
template<class InputIt >
void sheaf::singly_linked_list< T, A >::push_front ( InputIt  first,
InputIt  last 
)
inline

Prepends the range [first, last) to the beginning of the containter.

Definition at line 365 of file singly_linked_list.h.

◆ remove()

template<typename T, class A = list_ns::allocator<T>>
void sheaf::singly_linked_list< T, A >::remove ( const T &  value)
inline

Removes all elements with value.

Definition at line 413 of file singly_linked_list.h.

◆ resize() [1/2]

template<typename T, class A = list_ns::allocator<T>>
void sheaf::singly_linked_list< T, A >::resize ( size_type  count)
inline

Resizes the container to contain count elements. Additional value-initialized elements are appended.

Definition at line 386 of file singly_linked_list.h.

◆ resize() [2/2]

template<typename T, class A = list_ns::allocator<T>>
void sheaf::singly_linked_list< T, A >::resize ( size_type  count,
const value_type &  value 
)
inline

Resizes the container to contain count elements. Additional copies of value are appended.

Definition at line 395 of file singly_linked_list.h.

◆ reverse()

template<typename T, class A = list_ns::allocator<T>>
void sheaf::singly_linked_list< T, A >::reverse ( )
inline

Reverses the order of the elements in the container.

Definition at line 421 of file singly_linked_list.h.

◆ sort()

template<typename T, class A = list_ns::allocator<T>>
void sheaf::singly_linked_list< T, A >::sort ( )
inline

Sorts the elements in ascending order.

Definition at line 437 of file singly_linked_list.h.

◆ swap()

template<typename T, class A = list_ns::allocator<T>>
void sheaf::singly_linked_list< T, A >::swap ( singly_linked_list< T, A > &  other)
inline

Echanges the contents of the container with those of other. Does not invoke any move, copy, or swap operations on individual elements.

Definition at line 160 of file singly_linked_list.h.

◆ unique()

template<typename T, class A = list_ns::allocator<T>>
void sheaf::singly_linked_list< T, A >::unique ( )
inline

Removes all consecutive duplicate elements from the container.

Definition at line 429 of file singly_linked_list.h.


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