61#ifndef __ADS_RealTimeMinDeque
62 #define __ADS_RealTimeMinDeque
78#include <initializer_list>
94template< std::copy_constructible T ,
class C = std::less<> >
104 : f_A{ Array( 16 ) , Array( 16 ) } , f_cells( std::move( less ) ) { }
111 : f_A{ Array( 16 ) , Array( 16 ) } , f_cells( o.f_cells ) {
128 [[nodiscard]]
bool empty(
void )
const {
return( f_n == 0 ); }
131 [[nodiscard]] std::size_t
size(
void )
const {
return( f_n ); }
153 [[nodiscard]]
const T &
front(
void )
const {
return( end( 0 ) ); }
157 [[nodiscard]]
const T &
back(
void )
const {
return( end( 1 ) ); }
161 [[nodiscard]]
const T &
min(
void )
const;
172 using Array = detail::CellArray< T , std::size_t >;
173 using Cells = detail::MinCells< T , C >;
177 static constexpr int kSteps = 12;
178 static constexpr std::size_t kSmall = 32;
181 void push(
int s ,
const T & x );
211 const T & end(
int s )
const;
226 [[nodiscard]]
bool due(
void )
const;
230 void afterOp(
void );
261 std::array< Array , 2 > f_A;
262 std::array< Array , 2 > f_new;
263 std::array< Array , 4 > f_old;
266 std::size_t f_cs = 0;
267 std::size_t f_cg = 0;
283#include "ADS/queue/impl/RealTimeMinDeque.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The primitives of the processor that the compilers spell each in their own way, in one form for all: ...
The QUEUE with the minimum of exercise 3.15 of Morin's book in worst-case time per operation,...
bool empty(void) const
true if there is no item
Definition RealTimeMinDeque.h:128
RealTimeMinDeque & operator=(const RealTimeMinDeque &o)
the items of o, by copy and swap
RealTimeMinDeque(C less=C())
the empty deque, ordered by less
Definition RealTimeMinDeque.h:103
T pop_front(void)
removes the item at the front and returns it
Definition RealTimeMinDeque.h:144
T Item
the type of the items
Definition RealTimeMinDeque.h:100
void forEach(F &&f) const
f( x ) on the items from the front to the back,
const T & min(void) const
the least item, the lesser of the minima of the two stacks
void clear(void)
removes all the items
void push_back(const T &x)
at the back, on
Definition RealTimeMinDeque.h:139
RealTimeMinDeque(const RealTimeMinDeque &o)
a copy, item by item, in time
const T & back(void) const
the item at the back
Definition RealTimeMinDeque.h:157
RealTimeMinDeque(RealTimeMinDeque &&o) noexcept
the items of o, which is left empty
Definition RealTimeMinDeque.h:110
void swap(RealTimeMinDeque &o) noexcept
exchanges the items with o
RealTimeMinDeque & operator=(RealTimeMinDeque &&o) noexcept
the items of o, exchanged with those of this deque
Definition RealTimeMinDeque.h:119
const T & front(void) const
the item at the front
Definition RealTimeMinDeque.h:153
std::size_t size(void) const
the number of items
Definition RealTimeMinDeque.h:131
T pop_back(void)
removes the item at the back and returns it
Definition RealTimeMinDeque.h:149
void push_front(const T &x)
at the front, on
Definition RealTimeMinDeque.h:135
#define ADS_NO_UNIQUE_ADDRESS
an empty member that takes no storage, by the attribute that does so (the standard one is accepted bu...
Definition Portable.h:81