53#ifndef __ADS_RealTimeMinQueue
54 #define __ADS_RealTimeMinQueue
85template<
class T ,
class C >
89 using Summary = std::size_t;
92 explicit MinCells( C l = C() ) : less( std::move( l ) ) { }
110 template<
class A ,
class U >
111 void push( A & a , U && x )
const {
112 const std::size_t h = a.hi();
113 const std::size_t m =
114 ( h > a.lo() ) && ! less( x , a.at( a.summary( h - 1 ) ) )
117 a.push( std::forward< U >( x ) , m );
121 template<
class A ,
class U >
122 void pushFront( A & a , U && x )
const {
123 push( a , std::forward< U >( x ) );
127 template<
class A ,
class U >
128 void pushBack( A & a , U && x )
const {
129 push( a , std::forward< U >( x ) );
134 [[nodiscard]]
const T & min(
const A & a )
const {
135 return( a.at( a.summary( a.hi() - 1 ) ) );
149template<
class T ,
class C = std::less<> >
159 : f_q( Cells( std::move( less ) ) ) { }
177 [[nodiscard]]
bool empty(
void )
const {
return( f_q.size() == 0 ); }
180 [[nodiscard]] std::size_t
size(
void )
const {
return( f_q.size() ); }
220 [[nodiscard]]
const T &
top(
void )
const;
242 [[nodiscard]]
const T &
min(
void )
const;
253 using Cells = detail::MinCells< T , C >;
257 detail::RealTimeRotation< Cells > f_q;
269#include "ADS/queue/impl/RealTimeMinQueue.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 aggregate of a sliding window, beyond the book: a QUEUE of values of the monoid G [see Algebra....
T dequeue(void)
removes the item at the front, the top of , and returns it, with three moves of a rotation if one is ...
RealTimeMinQueue & operator=(const RealTimeMinQueue &o)=default
the items of o, by copy and swap
void clear(void)
removes all the items
void enqueue(const T &x)
at the back, on the stack , and three moves of a rotation if one is going on
const T & min(void) const
the least item, the least of the minima of the parts
RealTimeMinQueue & operator=(RealTimeMinQueue &&o) noexcept=default
the items of o, exchanged with those of this queue
T Item
the type of the items
Definition RealTimeMinQueue.h:155
RealTimeMinQueue(C less=C())
the empty queue, ordered by less
Definition RealTimeMinQueue.h:158
bool empty(void) const
true if there is no item
Definition RealTimeMinQueue.h:177
const T & top(void) const
the item at the front, the top of
void swap(RealTimeMinQueue &o) noexcept
exchanges the items with o
Definition RealTimeMinQueue.h:174
RealTimeMinQueue(RealTimeMinQueue &&o) noexcept=default
the items of o, which is left empty
void forEach(F &&f) const
f( x ) on the items from the front to the back,
std::size_t size(void) const
the number of items
Definition RealTimeMinQueue.h:180
RealTimeMinQueue(const RealTimeMinQueue &o)=default
a copy, item by item, in time
#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