template<typename Type>
bn::iforward_list class

Base class of bn::forward_list.

Template parameters
Type Element type.

Can be used as a reference type for all bn::forward_list containers containing a specific type.

Derived classes

template<typename Type, int MaxSize>
class forward_list
std::forward_list like container with a fixed size buffer.

Public types

class const_iterator
Const iterator.
class iterator
Non const iterator.
using value_type = Type
Value type alias.
using size_type = int
Size type alias.
using difference_type = int
Difference type alias.
using reference = Type&
Reference alias.
using const_reference = const Type&
Const reference alias.
using pointer = Type*
Pointer alias.
using const_pointer = const Type*
Const pointer alias.

Public functions

auto operator=(const iforward_list& other) -> iforward_list&
Copy assignment operator.
auto operator=(iforward_list&& other) -> iforward_list& noexcept
Move assignment operator.
auto size() const -> size_type
Returns the current size.
auto max_size() const -> size_type
Returns the maximum possible size.
auto available() const -> size_type
Returns the remaining capacity.
auto empty() const -> bool
Indicates if it doesn't contain any element.
auto full() const -> bool
Indicates if it can't contain any more elements.
auto before_begin() const -> const_iterator
Returns a const iterator to the position before the beginning of the iforward_list.
auto before_begin() -> iterator
Returns a const iterator to the beginning of the iforward_list.
auto begin() const -> const_iterator
Returns a const iterator to the beginning of the iforward_list.
auto begin() -> iterator
Returns an iterator to the beginning of the iforward_list.
auto end() const -> const_iterator
Returns a const iterator to the end of the iforward_list.
auto end() -> iterator
Returns an iterator to the end of the iforward_list.
auto cbefore_begin() const -> const_iterator
Returns a const iterator to the position before the beginning of the iforward_list.
auto cbegin() const -> const_iterator
Returns a const iterator to the beginning of the iforward_list.
auto cend() const -> const_iterator
Returns a const iterator to the end of the iforward_list.
auto front() const -> const_reference
Returns a const reference to the first element.
auto front() -> reference
Returns a reference to the first element.
void push_front(const_reference value)
Inserts a copy of a value at the beginning of the iforward_list.
void push_front(value_type&& value)
Inserts a moved value at the beginning of the iforward_list.
template<typename... Args>
auto emplace_front(Args && ... args) -> reference
Constructs and inserts a value at the beginning of the iforward_list.
void pop_front()
Removes the first element of the iforward_list.
auto insert_after(const_iterator position, const_reference value) -> iterator
Inserts a copy of a value at the specified position.
auto insert_after(const_iterator position, value_type&& value) -> iterator
Inserts a moved value at the specified position.
template<typename... Args>
auto emplace_after(const_iterator position, Args && ... args) -> iterator
Constructs and inserts a value at the specified position.
auto erase_after(const_iterator position) -> iterator
Erases an element.
auto erase_after(const_iterator first, const_iterator last) -> iterator
Erases a range of elements.
auto remove(const_reference value) -> size_type
Erases all elements that are equal to the specified value.
template<class Pred>
auto remove_if(const Pred& pred) -> size_type
Erases all elements that satisfy the specified predicate.
void assign(size_type count, const_reference value)
Assigns values to the iforward_list, removing the previous ones.
template<typename Iterator>
void assign(const Iterator& first, const Iterator& last)
Assigns values to the iforward_list, removing the previous ones.
void clear()
Removes all elements.
void swap(iforward_list& other)
Exchanges the contents of this iforward_list with those of the other one.

Friends

void swap(iforward_list& a, iforward_list& b)
Exchanges the contents of a iforward_list with those of another one.
auto operator==(const iforward_list& a, const iforward_list& b) -> bool
Equal operator.
auto operator<(const iforward_list& a, const iforward_list& b) -> bool
Less than operator.
auto operator>(const iforward_list& a, const iforward_list& b) -> bool
Greater than operator.
auto operator<=(const iforward_list& a, const iforward_list& b) -> bool
Less than or equal operator.
auto operator>=(const iforward_list& a, const iforward_list& b) -> bool
Greater than or equal operator.

Function documentation

template<typename Type>
iforward_list& bn::iforward_list<Type>::operator=(const iforward_list& other)

Copy assignment operator.

Parameters
other iforward_list to copy.
Returns Reference to this.

template<typename Type>
iforward_list& bn::iforward_list<Type>::operator=(iforward_list&& other) noexcept

Move assignment operator.

Parameters
other iforward_list to move.
Returns Reference to this.

template<typename Type>
void bn::iforward_list<Type>::push_front(const_reference value)

Inserts a copy of a value at the beginning of the iforward_list.

Parameters
value Value to insert.

template<typename Type>
void bn::iforward_list<Type>::push_front(value_type&& value)

Inserts a moved value at the beginning of the iforward_list.

Parameters
value Value to insert.

template<typename Type> template<typename... Args>
reference bn::iforward_list<Type>::emplace_front(Args && ... args)

Constructs and inserts a value at the beginning of the iforward_list.

Parameters
args Parameters of the value to insert.
Returns Reference to the new value.

template<typename Type>
iterator bn::iforward_list<Type>::insert_after(const_iterator position, const_reference value)

Inserts a copy of a value at the specified position.

Parameters
position The given value is inserted after this position.
value Value to insert.
Returns Iterator pointing to the inserted value.

template<typename Type>
iterator bn::iforward_list<Type>::insert_after(const_iterator position, value_type&& value)

Inserts a moved value at the specified position.

Parameters
position The given value is inserted after this position.
value Value to insert.
Returns Iterator pointing to the inserted value.

template<typename Type> template<typename... Args>
iterator bn::iforward_list<Type>::emplace_after(const_iterator position, Args && ... args)

Constructs and inserts a value at the specified position.

Parameters
position The new value is inserted after this position.
args Parameters of the value to insert.
Returns Iterator pointing to the new value.

template<typename Type>
iterator bn::iforward_list<Type>::erase_after(const_iterator position)

Erases an element.

Parameters
position Iterator to the previous element to the one to erase.
Returns Iterator following the erased element.

template<typename Type>
iterator bn::iforward_list<Type>::erase_after(const_iterator first, const_iterator last)

Erases a range of elements.

Parameters
first Iterator to the first element to erase.
last Iterator to the last element to erase.
Returns Iterator following the last erased element.

The range includes all the elements between first and last, including the element pointed by last, but not the one pointed by first.

template<typename Type>
size_type bn::iforward_list<Type>::remove(const_reference value)

Erases all elements that are equal to the specified value.

Parameters
value Element to erase.
Returns Number of erased elements.

template<typename Type> template<class Pred>
size_type bn::iforward_list<Type>::remove_if(const Pred& pred)

Erases all elements that satisfy the specified predicate.

Parameters
pred Unary predicate which returns true if the element should be erased.
Returns Number of erased elements.

template<typename Type>
void bn::iforward_list<Type>::assign(size_type count, const_reference value)

Assigns values to the iforward_list, removing the previous ones.

Parameters
count Number of elements to insert.
value Value to fill new elements with.

template<typename Type> template<typename Iterator>
void bn::iforward_list<Type>::assign(const Iterator& first, const Iterator& last)

Assigns values to the iforward_list, removing the previous ones.

Parameters
first Iterator to the first element to insert.
last Iterator following to the last element to insert.

template<typename Type>
void bn::iforward_list<Type>::swap(iforward_list& other)

Exchanges the contents of this iforward_list with those of the other one.

Parameters
other iforward_list to exchange the contents with.

template<typename Type>
void swap(iforward_list& a, iforward_list& b)

Exchanges the contents of a iforward_list with those of another one.

Parameters
a First iforward_list to exchange the contents with.
b Second iforward_list to exchange the contents with.

template<typename Type>
bool operator==(const iforward_list& a, const iforward_list& b)

Equal operator.

Parameters
a First iforward_list to compare.
b Second iforward_list to compare.
Returns true if the first iforward_list is equal to the second one, otherwise false.

template<typename Type>
bool operator<(const iforward_list& a, const iforward_list& b)

Less than operator.

Parameters
a First iforward_list to compare.
b Second iforward_list to compare.
Returns true if the first iforward_list is lexicographically less than the second one, otherwise false.

template<typename Type>
bool operator>(const iforward_list& a, const iforward_list& b)

Greater than operator.

Parameters
a First iforward_list to compare.
b Second iforward_list to compare.
Returns true if the first iforward_list is lexicographically greater than the second one, otherwise false.

template<typename Type>
bool operator<=(const iforward_list& a, const iforward_list& b)

Less than or equal operator.

Parameters
a First iforward_list to compare.
b Second iforward_list to compare.
Returns true if the first iforward_list is lexicographically less than or equal to the second one, otherwise false.

template<typename Type>
bool operator>=(const iforward_list& a, const iforward_list& b)

Greater than or equal operator.

Parameters
a First iforward_list to compare.
b Second iforward_list to compare.
Returns true if the first iforward_list is lexicographically greater than or equal to the second one, otherwise false.