51#include <initializer_list>
88 Treque( std::initializer_list< T > l );
91 [[nodiscard]]
bool empty(
void )
const {
return(
size() == 0 ); }
94 [[nodiscard]] std::size_t
size(
void )
const {
95 return( f_L.size() + f_R.size() );
102 return( i < f_L.size() ? f_L[ i ] : f_R[ i - f_L.size() ] );
109 return( i < f_L.size() ? f_L[ i ] : f_R[ i - f_L.size() ] );
114 [[nodiscard]]
const T &
front(
void )
const {
return( ( *
this )[ 0 ] ); }
118 [[nodiscard]]
const T &
back(
void )
const {
119 return( ( *
this )[
size() - 1 ] );
137 void insert( std::size_t i ,
const T & x );
161 const std::size_t i = rankOf( p );
163 return(
begin() + std::ptrdiff_t( i ) );
169 template< std::input_iterator I , std::sentinel_for< I > E >
171 const std::size_t i0 = rankOf( p );
172 for( std::size_t i = i0 ; first != last ; ++first )
173 insert( i++ , T( *first ) );
174 return(
begin() + std::ptrdiff_t( i0 ) );
178 template<
class... A >
180 return(
insert( p , T( std::forward< A >( a )... ) ) );
187 const std::size_t i = rankOf( p );
189 return(
begin() + std::ptrdiff_t( i ) );
195 const std::size_t i = rankOf( first );
196 for( std::size_t k = rankOf( last ) - i ; k > 0 ; --k )
198 return(
begin() + std::ptrdiff_t( i ) );
245 return( std::size_t( p -
begin() ) );
261 void balance(
void );
264 [[nodiscard]]
bool balanced(
void )
const;
279#include "ADS/sequence/impl/Treque.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The iterators that the containers of the library have in common, beyond the book: they give a contain...
A double ended queue on a circular vector that grows, beyond the book: the circular vector of ArrayQu...
the random-access iterator on the items of a container C read by rank, c[ i ] the item ,...
Definition Iterators.h:392
void clear(void)
removes all the items
Definition Treque.h:216
void erase(std::size_t i)
removes the item of rank , in time
iterator insert(const_iterator p, I first, E last)
the items of before the item of , in their order, one insert( i , x ) each; an iterator on the first...
Definition Treque.h:170
iterator insert(const_iterator p, const T &x)
before the item of , i.e., insert( i , x ) with the rank of : the members by iterator of a SequenceC...
Definition Treque.h:160
iterator end(void)
the iterator past the last item
Definition Treque.h:227
void pop_front(void)
removes the first item
Definition Treque.h:209
iterator erase(const_iterator p)
the item of removed, i.e., erase( i ) with its rank; an iterator on the item after it
Definition Treque.h:186
void push_front(const T &x)
at the front
Definition Treque.h:202
T & operator[](std::size_t i)
the item of rank , in or in
Definition Treque.h:100
const T & back(void) const
the last item
Definition Treque.h:118
std::size_t size_type
the type of the sizes
Definition Treque.h:75
const T & const_reference
a constant reference
Definition Treque.h:78
Treque(std::initializer_list< T > l)
the items of l, in order
const_iterator cend(void) const
the constant iterator past the last item
Definition Treque.h:239
RankIterator< Treque, T, true > const_iterator
the iterator on the constant items
Definition Treque.h:82
iterator emplace(const_iterator p, A &&... a)
an item built from before the item of
Definition Treque.h:179
bool operator==(const Treque &o) const
the same items in the same order
std::size_t size(void) const
the number of items
Definition Treque.h:94
const_iterator cbegin(void) const
the constant iterator on the first item
Definition Treque.h:237
void push_back(const T &x)
at the back
Definition Treque.h:205
RankIterator< Treque, T, false > iterator
the iterator on the items
Definition Treque.h:80
const T & front(void) const
the first item
Definition Treque.h:114
iterator erase(const_iterator first, const_iterator last)
the items of removed, one erase( i ) each; an iterator on the item after them
Definition Treque.h:194
Treque(void)=default
the empty treque
const_iterator end(void) const
the constant iterator past the last item
Definition Treque.h:233
bool empty(void) const
true if there is no item
Definition Treque.h:91
const T & operator[](std::size_t i) const
the item of rank , constant
Definition Treque.h:107
T & reference
a reference to an item
Definition Treque.h:77
T value_type
the type of the items
Definition Treque.h:74
const_iterator begin(void) const
the constant iterator on the first item
Definition Treque.h:229
void insert(std::size_t i, const T &x)
puts at the rank , in amortized time
std::ptrdiff_t difference_type
the type of the distances
Definition Treque.h:76
void pop_back(void)
removes the last item
Definition Treque.h:213
iterator begin(void)
the iterator on the first item
Definition Treque.h:225
#define ADS_PRE(cond)
[check]
Definition Contract.h:121