#include <bn_deque.h>
template<typename Type>
ideque class
Base class of bn::
Template parameters | |
---|---|
Type | Element type. |
Can be used as a reference type for all bn::
Derived classes
-
template<typename Type, int MaxSize>class deque
- A
std::deque
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.
- using reverse_iterator = bn::reverse_iterator<iterator>
- Reverse iterator alias.
-
using const_reverse_iterator = bn::reverse_iterator<const_
iterator> - Const reverse iterator alias.
Constructors, destructors, conversion operators
Public functions
- auto operator=(const ideque& other) -> ideque&
- Copy assignment operator.
- auto operator=(ideque&& other) -> ideque& noexcept
- Move assignment operator.
-
auto size() const -> size_
type - Returns the current elements count.
-
auto max_size() const -> size_
type - Returns the maximum possible elements count.
-
auto available() const -> size_
type - Returns the remaining element 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 begin() const -> const_
iterator - Returns a const iterator to the beginning of the ideque.
- auto begin() -> iterator
- Returns an iterator to the beginning of the ideque.
-
auto end() const -> const_
iterator - Returns a const iterator to the end of the ideque.
- auto end() -> iterator
- Returns an iterator to the end of the ideque.
-
auto cbegin() const -> const_
iterator - Returns a const iterator to the beginning of the ideque.
-
auto cend() const -> const_
iterator - Returns a const iterator to the end of the ideque.
-
auto rbegin() const -> const_
reverse_ iterator - Returns a const reverse iterator to the end of the ideque.
-
auto rbegin() -> reverse_
iterator - Returns a reverse iterator to the end of the ideque.
-
auto rend() const -> const_
reverse_ iterator - Returns a const reverse iterator to the beginning of the ideque.
-
auto rend() -> reverse_
iterator - Returns a reverse iterator to the beginning of the ideque.
-
auto crbegin() const -> const_
reverse_ iterator - Returns a const reverse iterator to the end of the ideque.
-
auto crend() const -> const_
reverse_ iterator - Returns a const reverse iterator to the beginning of the ideque.
-
auto operator[](size_
type index) const -> const_ reference - Returns a const reference to the value stored at the specified index.
-
auto operator[](size_
type index) -> reference - Returns a reference to the value stored at the specified index.
-
auto at(size_
type index) const -> const_ reference - Returns a const reference to the value stored at the specified index.
-
auto at(size_
type index) -> reference - Returns a reference to the value stored at the specified index.
-
auto front() const -> const_
reference - Returns a const reference to the first element.
- auto front() -> reference
- Returns a reference to the first element.
-
auto back() const -> const_
reference - Returns a const reference to the last element.
- auto back() -> reference
- Returns a reference to the last element.
-
void push_front(const_
reference value) - Inserts a copy of a value at the beginning of the ideque.
-
void push_front(value_
type&& value) - Inserts a moved value at the beginning of the ideque.
-
template<typename... Args>auto emplace_front(Args && ... args) -> reference
- Constructs and inserts a value at the beginning of the ideque.
-
void push_back(const_
reference value) - Inserts a copy of a value at the end of the ideque.
-
void push_back(value_
type&& value) - Inserts a moved value at the end of the ideque.
-
template<typename... Args>auto emplace_back(Args && ... args) -> reference
- Constructs and inserts a value at the end of the ideque.
- void pop_front()
- Removes the first element of the ideque.
- void pop_back()
- Removes the last element of the ideque.
-
auto insert(const const_
iterator& position, const_ reference value) -> iterator - Inserts a copy of a value at the specified position.
-
auto insert(const const_
iterator& position, value_ type&& value) -> iterator - Inserts a moved value at the specified position.
-
template<typename... Args>auto emplace(const const_
iterator& position, Args && ... args) -> iterator - Constructs and inserts a value at the specified position.
-
auto erase(const const_
iterator& position) -> iterator - Erases an element.
-
auto erase(const const_
iterator& first, const const_ iterator& last) -> iterator - Erases a range of elements.
-
void resize(size_
type count) - Resizes the ideque.
-
void resize(size_
type count, const_ reference value) - Resizes the ideque.
-
void shrink(size_
type count) - Resizes the ideque to a size less or equal than the previous one.
-
void assign(size_
type count, const_ reference value) - Assigns values to the ideque, removing the previous ones.
-
template<typename Iterator>void assign(const Iterator& first, const Iterator& last)
- Assigns values to the ideque, removing the previous ones.
- void clear()
- Removes all elements.
- void clear()
- Removes all elements.
- void swap(ideque& other)
- Exchanges the contents of this ideque with those of the other one.
Friends
- void swap(ideque& a, ideque& b)
- Exchanges the contents of a ideque with those of another one.
- auto operator==(const ideque& a, const ideque& b) -> bool
- Equal operator.
- auto operator!=(const ideque& a, const ideque& b) -> bool
- Not equal operator.
- auto operator<(const ideque& a, const ideque& b) -> bool
- Less than operator.
- auto operator>(const ideque& a, const ideque& b) -> bool
- Greater than operator.
- auto operator<=(const ideque& a, const ideque& b) -> bool
- Less than or equal operator.
- auto operator>=(const ideque& a, const ideque& b) -> bool
- Greater than or equal operator.
Function documentation
template<typename Type>
void bn:: ideque<Type>:: push_front(const_ reference value)
Inserts a copy of a value at the beginning of the ideque.
Parameters | |
---|---|
value | Value to insert. |
template<typename Type>
void bn:: ideque<Type>:: push_front(value_ type&& value)
Inserts a moved value at the beginning of the ideque.
Parameters | |
---|---|
value | Value to insert. |
template<typename Type>
template<typename... Args>
reference bn:: ideque<Type>:: emplace_front(Args && ... args)
Constructs and inserts a value at the beginning of the ideque.
Parameters | |
---|---|
args | Parameters of the value to insert. |
Returns | Reference to the new value. |
template<typename Type>
void bn:: ideque<Type>:: push_back(const_ reference value)
Inserts a copy of a value at the end of the ideque.
Parameters | |
---|---|
value | Value to insert. |
template<typename Type>
void bn:: ideque<Type>:: push_back(value_ type&& value)
Inserts a moved value at the end of the ideque.
Parameters | |
---|---|
value | Value to insert. |
template<typename Type>
template<typename... Args>
reference bn:: ideque<Type>:: emplace_back(Args && ... args)
Constructs and inserts a value at the end of the ideque.
Parameters | |
---|---|
args | Parameters of the value to insert. |
Returns | Reference to the new value. |
template<typename Type>
iterator bn:: ideque<Type>:: insert(const const_ iterator& position,
const_ reference value)
Inserts a copy of a value at the specified position.
Parameters | |
---|---|
position | The given value is inserted before this position. |
value | Value to insert. |
Returns | Iterator pointing to the inserted value. |
template<typename Type>
iterator bn:: ideque<Type>:: insert(const const_ iterator& position,
value_ type&& value)
Inserts a moved value at the specified position.
Parameters | |
---|---|
position | The given value is inserted before this position. |
value | Value to insert. |
Returns | Iterator pointing to the inserted value. |
template<typename Type>
template<typename... Args>
iterator bn:: ideque<Type>:: emplace(const const_ iterator& position,
Args && ... args)
Constructs and inserts a value at the specified position.
Parameters | |
---|---|
position | The new value is inserted before this position. |
args | Parameters of the value to insert. |
Returns | Iterator pointing to the new value. |
template<typename Type>
iterator bn:: ideque<Type>:: erase(const const_ iterator& position)
Erases an element.
Parameters | |
---|---|
position | Iterator to the element to erase. |
Returns | Iterator following the erased element. |
template<typename Type>
iterator bn:: ideque<Type>:: erase(const const_ iterator& first,
const 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 first, but not the one pointed by last.
template<typename Type>
void bn:: ideque<Type>:: resize(size_ type count,
const_ reference value)
Resizes the ideque.
Parameters | |
---|---|
count | New size. |
value | Value to fill new elements with. |
template<typename Type>
void bn:: ideque<Type>:: assign(size_ type count,
const_ reference value)
Assigns values to the ideque, 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:: ideque<Type>:: assign(const Iterator& first,
const Iterator& last)
Assigns values to the ideque, 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>
bool operator==(const ideque& a,
const ideque& b)
Equal operator.
Parameters | |
---|---|
a | First ideque to compare. |
b | Second ideque to compare. |
Returns | true if the first ideque is equal to the second one, otherwise false . |
template<typename Type>
bool operator!=(const ideque& a,
const ideque& b)
Not equal operator.
Parameters | |
---|---|
a | First ideque to compare. |
b | Second ideque to compare. |
Returns | true if the first ideque is not equal to the second one, otherwise false . |
template<typename Type>
bool operator<=(const ideque& a,
const ideque& b)
Less than or equal operator.
Parameters | |
---|---|
a | First ideque to compare. |
b | Second ideque to compare. |
Returns | true if the first ideque is lexicographically less than or equal to the second one, otherwise false . |
template<typename Type>
bool operator>=(const ideque& a,
const ideque& b)
Greater than or equal operator.
Parameters | |
---|---|
a | First ideque to compare. |
b | Second ideque to compare. |
Returns | true if the first ideque is lexicographically greater than or equal to the second one, otherwise false . |