50#ifndef __ADS_ContiguousDeque
51 #define __ADS_ContiguousDeque
63#include <initializer_list>
123 [[nodiscard]]
bool empty(
void )
const {
return( f_n == 0 ); }
126 [[nodiscard]] std::size_t
size(
void )
const {
return( f_n ); }
129 [[nodiscard]] std::size_t
capacity(
void )
const {
return( f_c ); }
135 return( f_A[ f_h + i ] );
142 return( f_A[ f_h + i ] );
149 return( f_A[ f_h ] );
154 [[nodiscard]] T &
back(
void ) {
156 return( f_A[ f_h + f_n - 1 ] );
160 [[nodiscard]] T *
data(
void ) {
return( f_A + f_h ); }
163 [[nodiscard]]
const T *
data(
void )
const {
return( f_A + f_h ); }
185 void insert( std::size_t i ,
const T & x );
260 void rebuild(
void );
263 [[nodiscard]]
bool fits(
void )
const {
return( f_h + f_n <= f_c ); }
280#include "ADS/sequence/impl/ContiguousDeque.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
ContiguousDeque(std::initializer_list< T > l)
the items of l, in order
void push_front(const T &x)
at the front, amortized
void clear(void)
removes all the items, the places kept
const T & const_reference
a constant reference
Definition ContiguousDeque.h:93
void pop_front(void)
removes the first item
Definition ContiguousDeque.h:215
bool operator==(const ContiguousDeque &o) const
the same items in the same order
Definition ContiguousDeque.h:225
const T * data(void) const
the items, contiguous and constant
Definition ContiguousDeque.h:163
reverse_iterator rend(void)
the iterator before the first item, backwards
Definition ContiguousDeque.h:242
std::reverse_iterator< iterator > reverse_iterator
the iterator on the items, backwards
Definition ContiguousDeque.h:97
T & back(void)
the last item
Definition ContiguousDeque.h:154
ContiguousDeque & operator=(ContiguousDeque o) noexcept
the items of o, by copy and swap
void swap(ContiguousDeque &o) noexcept
exchanges the vector with that of o
void erase(std::size_t i)
removes the item of rank , moving the items of the shorter side by one place, in amortized time
iterator begin(void)
the iterator on the first item
Definition ContiguousDeque.h:230
ContiguousDeque(ContiguousDeque &&o) noexcept
the vector of o, which is left empty with no places
~ContiguousDeque()
destroys the items and frees the places
reverse_iterator rbegin(void)
the iterator on the last item, backwards
Definition ContiguousDeque.h:238
std::size_t capacity(void) const
the number of places
Definition ContiguousDeque.h:129
T * iterator
the iterator on the items
Definition ContiguousDeque.h:94
std::size_t size_type
the type of the sizes
Definition ContiguousDeque.h:90
ContiguousDeque(void)=default
the empty deque, with no places
T & reference
a reference to an item
Definition ContiguousDeque.h:92
const_iterator begin(void) const
the constant iterator on the first item
Definition ContiguousDeque.h:234
void push_back(const T &x)
at the back, amortized
void pop_back(void)
removes the last item
Definition ContiguousDeque.h:219
const_iterator end(void) const
the constant iterator past the last item
Definition ContiguousDeque.h:236
std::ptrdiff_t difference_type
the type of the distances
Definition ContiguousDeque.h:91
const T * const_iterator
on the constant items
Definition ContiguousDeque.h:95
T * data(void)
the items, contiguous
Definition ContiguousDeque.h:160
std::size_t size(void) const
the number of items
Definition ContiguousDeque.h:126
ContiguousDeque(const ContiguousDeque &o)
a copy of o
T & front(void)
the first item
Definition ContiguousDeque.h:147
T & operator[](std::size_t i)
the item of rank ,
Definition ContiguousDeque.h:133
bool empty(void) const
true if there is no item
Definition ContiguousDeque.h:123
const T & operator[](std::size_t i) const
the item of rank , constant
Definition ContiguousDeque.h:140
iterator end(void)
the iterator past the last item
Definition ContiguousDeque.h:232
std::reverse_iterator< const_iterator > const_reverse_iterator
the iterator on the constant items, backwards
Definition ContiguousDeque.h:99
T value_type
the type of the items
Definition ContiguousDeque.h:89
void insert(std::size_t i, const T &x)
puts at the rank , moving the items of the shorter side by one place, in amortized time
#define ADS_PRE(cond)
[check]
Definition Contract.h:121