79#ifndef __ADS_ArraySequence
80 #define __ADS_ArraySequence
91#include <initializer_list>
124 template< std::input_iterator I , std::sentinel_for< I > S >
141 [[nodiscard]]
bool empty(
void )
const;
203 template< std::input_iterator I , std::sentinel_for< I > S >
282 [[nodiscard]]
iterator end(
void ) {
return( f_A.get() + f_size ); }
287 return( f_A.get() + f_size );
311 [[nodiscard]] T *
data(
void ) {
return( f_A.get() ); }
313 [[nodiscard]]
const T *
data(
void )
const {
return( f_A.get() ); }
329 [[nodiscard]]
bool fits(
void )
const;
337 void resize(
Pos c );
339 std::unique_ptr< T[] > f_A;
353#include "ADS/sequence/impl/ArraySequence.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
const_iterator end(void) const
the constant iterator past the last item
Definition ArraySequence.h:286
T * pointer
a pointer to an item
Definition ArraySequence.h:267
Pos capacity(void) const
the size of the vector, which the analysis of the doubling is about
Pos tail(void) const
the position of the last item,
void write(Pos p, const T &v)
writes at the index
const T & read(Pos p) const
the item at the index
void push_back(const T &v)
at the end, for std::back_inserter
ArraySequence(void)
the empty sequence, with no vector
T & operator[](Pos i)
the item at the index
std::reverse_iterator< const_iterator > const_reverse_iterator
the iterator on the constant items, backwards
Definition ArraySequence.h:277
reverse_iterator rend(void)
the iterator before the first item, backwards
Definition ArraySequence.h:298
const_reverse_iterator rbegin(void) const
the constant iterator on the last item, backwards
Definition ArraySequence.h:302
T * data(void)
the vector of the items
Definition ArraySequence.h:311
bool operator==(const ArraySequence &o) const
the same items in the same order
ArraySequence(ArraySequence &&other) noexcept
the items of other, which is left empty
iterator end(void)
the iterator past the last item
Definition ArraySequence.h:282
reverse_iterator rbegin(void)
the iterator on the last item, backwards
Definition ArraySequence.h:294
ArraySequence(std::initializer_list< T > items)
the sequence of the given items, in their order
const T & operator[](Pos i) const
the item at the index , constant
Pos insert(Pos p, I first, S last)
puts the items of [ first , last ) at the indices , in their order, the items from the index moving...
const_iterator cend(void) const
the constant iterator past the last item
Definition ArraySequence.h:292
long Pos
a position is an index, from -1 to
Definition ArraySequence.h:115
T Item
the type of the items
Definition ArraySequence.h:114
ArraySequence & operator=(ArraySequence other) noexcept
the items of other, by copy and swap
ArraySequence(I first, S last)
the sequence of the items of [ first , last ), in their order
bool finished(Pos p) const
true if is -1 or
T * iterator
the iterator on the items
Definition ArraySequence.h:271
iterator begin(void)
the iterator on the first item
Definition ArraySequence.h:280
Pos next(Pos p) const
the position
const_iterator cbegin(void) const
the constant iterator on the first item
Definition ArraySequence.h:290
Pos remove(Pos p)
removes the item at the index , the following ones moving one place back; a vector left a quarter ful...
const T * const_pointer
a constant pointer to an item
Definition ArraySequence.h:269
const T & const_reference
a constant reference to an item
Definition ArraySequence.h:265
Pos prev(Pos p) const
the position
ArraySequence(const ArraySequence &other)
a copy of other
const_iterator begin(void) const
the constant iterator on the first item
Definition ArraySequence.h:284
bool empty(void) const
true if there is no item, i.e.,
Pos size(void) const
the number of items,
Pos head(void) const
the position of the first item, 0
Pos insert(Pos p, const T &v)
puts at the index , the items from the index moving one place on, which takes time,...
const_reverse_iterator rend(void) const
the constant iterator before the first item, backwards
Definition ArraySequence.h:306
T & reference
a reference to an item
Definition ArraySequence.h:263
std::size_t size_type
the type of the sizes
Definition ArraySequence.h:259
std::ptrdiff_t difference_type
the type of the distances
Definition ArraySequence.h:261
T value_type
the type of the items
Definition ArraySequence.h:257
const T * data(void) const
the vector of the items, constant
Definition ArraySequence.h:313
const T * const_iterator
the iterator on the constant items
Definition ArraySequence.h:273
std::reverse_iterator< iterator > reverse_iterator
the iterator on the items, backwards
Definition ArraySequence.h:275