#include <bn_intrusive_forward_list.h>
template<typename Type>
intrusive_forward_list class
std::forward_list
like container that doesn't contain values, it just references them.
Template parameters | |
---|---|
Type | Element type (it must inherit bn:: |
It doesn't throw exceptions. Instead, asserts are used to ensure valid usage.
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.
Constructors, destructors, conversion operators
- intrusive_forward_list() defaulted
- Default constructor.
-
intrusive_forward_list(intrusive_
forward_ list&& other) noexcept - Move constructor.
- ~intrusive_forward_list() noexcept
- Destructor.
Public functions
-
auto operator=(intrusive_
forward_ list&& other) -> intrusive_ forward_ list& noexcept - Move assignment operator.
-
auto size() const -> size_
type - Returns the current size.
- auto empty() const -> bool
- Indicates if it doesn't contain any element.
-
auto before_begin() const -> const_
iterator - Returns a const iterator to the position before the beginning of the intrusive_
forward_ list. - auto before_begin() -> iterator
- Returns an iterator to the position before the beginning of the intrusive_
forward_ list. -
auto begin() const -> const_
iterator - Returns a const iterator to the beginning of the intrusive_
forward_ list. - auto begin() -> iterator
- Returns an iterator to the beginning of the intrusive_
forward_ list. -
auto end() const -> const_
iterator - Returns a const iterator to the end of the intrusive_
forward_ list. - auto end() -> iterator
- Returns an iterator to the end of the intrusive_
forward_ list. -
auto cbefore_begin() const -> const_
iterator - Returns a const iterator to the position before the beginning of the intrusive_
forward_ list. -
auto cbegin() const -> const_
iterator - Returns a const iterator to the beginning of the intrusive_
forward_ list. -
auto cend() const -> const_
iterator - Returns a const iterator to the end of the intrusive_
forward_ 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(reference value)
- Inserts a value at the beginning of the intrusive_
forward_ list. - void pop_front()
- Removes the first element of the intrusive_
forward_ list. -
auto insert_after(const_
iterator position, reference value) -> iterator - Inserts a value at the specified position.
- auto insert_after(reference position_value, reference value) -> iterator
- Inserts a value at the specified position.
-
auto erase_after(const_
iterator position) -> iterator - Erases an element.
- auto erase_after(reference value) -> 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.
-
template<typename Iterator>void assign(const Iterator& first, const Iterator& last)
- Assigns values to the intrusive_
forward_ list, removing the previous ones. - void clear()
- Removes all elements.
-
void swap(intrusive_
forward_ list& other) - Exchanges the contents of this intrusive_
forward_ list with those of the other one.
Friends
-
void swap(intrusive_
forward_ list& a, intrusive_ forward_ list& b) - Exchanges the contents of a intrusive_
forward_ list with those of another one. -
auto operator==(const intrusive_
forward_ list& a, const intrusive_ forward_ list& b) -> bool - Equal operator.
-
auto operator<(const intrusive_
forward_ list& a, const intrusive_ forward_ list& b) -> bool - Less than operator.
-
auto operator>(const intrusive_
forward_ list& a, const intrusive_ forward_ list& b) -> bool - Greater than operator.
-
auto operator<=(const intrusive_
forward_ list& a, const intrusive_ forward_ list& b) -> bool - Less than or equal operator.
-
auto operator>=(const intrusive_
forward_ list& a, const intrusive_ forward_ list& b) -> bool - Greater than or equal operator.
Function documentation
template<typename Type>
bn:: intrusive_forward_list<Type>:: intrusive_forward_list(intrusive_ forward_ list&& other) noexcept
Move constructor.
Parameters | |
---|---|
other | intrusive_ |
template<typename Type>
intrusive_ forward_ list& bn:: intrusive_forward_list<Type>:: operator=(intrusive_ forward_ list&& other) noexcept
Move assignment operator.
Parameters | |
---|---|
other | intrusive_ |
Returns | Reference to this. |
template<typename Type>
void bn:: intrusive_forward_list<Type>:: push_front(reference value)
Inserts a value at the beginning of the intrusive_
Parameters | |
---|---|
value | Value to insert. |
template<typename Type>
iterator bn:: intrusive_forward_list<Type>:: insert_after(const_ iterator position,
reference value)
Inserts 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:: intrusive_forward_list<Type>:: insert_after(reference position_value,
reference value)
Inserts a value at the specified position.
Parameters | |
---|---|
position_value | The given value is inserted after the position of this value in the intrusive_ |
value | Value to insert. |
Returns | Iterator pointing to the inserted value. |
template<typename Type>
iterator bn:: intrusive_forward_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:: intrusive_forward_list<Type>:: erase_after(reference value)
Erases an element.
Parameters | |
---|---|
value | Previous element to the one to erase. |
Returns | Iterator following the erased element. |
template<typename Type>
iterator bn:: intrusive_forward_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:: intrusive_forward_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<typename Iterator>
void bn:: intrusive_forward_list<Type>:: assign(const Iterator& first,
const Iterator& last)
Assigns values to the intrusive_
Parameters | |
---|---|
first | Iterator to the first element to insert. |
last | Iterator following to the last element to insert. |
template<typename Type>
void bn:: intrusive_forward_list<Type>:: swap(intrusive_ forward_ list& other)
Exchanges the contents of this intrusive_
Parameters | |
---|---|
other | intrusive_ |
template<typename Type>
void swap(intrusive_ forward_ list& a,
intrusive_ forward_ list& b)
Exchanges the contents of a intrusive_
Parameters | |
---|---|
a | First intrusive_ |
b | Second intrusive_ |
template<typename Type>
bool operator==(const intrusive_ forward_ list& a,
const intrusive_ forward_ list& b)
Equal operator.
Parameters | |
---|---|
a | First intrusive_ |
b | Second intrusive_ |
Returns | true if the first intrusive_false . |
template<typename Type>
bool operator<(const intrusive_ forward_ list& a,
const intrusive_ forward_ list& b)
Less than operator.
Parameters | |
---|---|
a | First intrusive_ |
b | Second intrusive_ |
Returns | true if the first intrusive_false . |
template<typename Type>
bool operator>(const intrusive_ forward_ list& a,
const intrusive_ forward_ list& b)
Greater than operator.
Parameters | |
---|---|
a | First intrusive_ |
b | Second intrusive_ |
Returns | true if the first intrusive_false . |
template<typename Type>
bool operator<=(const intrusive_ forward_ list& a,
const intrusive_ forward_ list& b)
Less than or equal operator.
Parameters | |
---|---|
a | First intrusive_ |
b | Second intrusive_ |
Returns | true if the first intrusive_false . |
template<typename Type>
bool operator>=(const intrusive_ forward_ list& a,
const intrusive_ forward_ list& b)
Greater than or equal operator.
Parameters | |
---|---|
a | First intrusive_ |
b | Second intrusive_ |
Returns | true if the first intrusive_false . |