yat  0.20.3pre
Classes | Public Member Functions | List of all members
theplu::yat::utility::SortedBuffer< T, OutputIterator, Comp > Class Template Reference

#include <yat/utility/SortedBuffer.h>

Public Member Functions

 SortedBuffer (OutputIterator out)
 
 SortedBuffer (OutputIterator out, const Comp &comp)
 
virtual ~SortedBuffer (void)
 Destructor. More...
 
void flush (void)
 
void flush_all (void)
 
void flush (const T &t)
 
void push (const T &t)
 
void push (T &&t)
 
const T & top (void) const
 

Detailed Description

template<typename T, typename OutputIterator, typename Comp = typename std::less<T>>
class theplu::yat::utility::SortedBuffer< T, OutputIterator, Comp >

SortedBuffer is similar to a priority queue. Elements are pushed into the container and flushed to an output iterator in a sorted manner. Ny default elements are sorted using std::less such that the smallest element is flushed first, but this can be modified using a different functor.

Since
new in yat 0.19

Constructor & Destructor Documentation

◆ SortedBuffer() [1/2]

template<typename T, typename OutputIterator, typename Comp = typename std::less<T>>
theplu::yat::utility::SortedBuffer< T, OutputIterator, Comp >::SortedBuffer ( OutputIterator  out)
inline
Parameters
outiterator that elements are copied to

◆ SortedBuffer() [2/2]

template<typename T, typename OutputIterator, typename Comp = typename std::less<T>>
theplu::yat::utility::SortedBuffer< T, OutputIterator, Comp >::SortedBuffer ( OutputIterator  out,
const Comp &  comp 
)
inline
Parameters
outIterator that elements are copied to
compComparator used to sort elements

◆ ~SortedBuffer()

template<typename T, typename OutputIterator, typename Comp = typename std::less<T>>
virtual theplu::yat::utility::SortedBuffer< T, OutputIterator, Comp >::~SortedBuffer ( void  )
inlinevirtual

Destructor.

Flush all elements to output iterator

Member Function Documentation

◆ flush() [1/2]

template<typename T, typename OutputIterator, typename Comp = typename std::less<T>>
void theplu::yat::utility::SortedBuffer< T, OutputIterator, Comp >::flush ( void  )
inline

Flush one element to output iterator

◆ flush() [2/2]

template<typename T, typename OutputIterator, typename Comp = typename std::less<T>>
void theplu::yat::utility::SortedBuffer< T, OutputIterator, Comp >::flush ( const T &  t)
inline

Flush all elements that are less than t.

◆ flush_all()

template<typename T, typename OutputIterator, typename Comp = typename std::less<T>>
void theplu::yat::utility::SortedBuffer< T, OutputIterator, Comp >::flush_all ( void  )
inline

Copy elements in a sorted fashion to the output iterator.

◆ push() [1/2]

template<typename T, typename OutputIterator, typename Comp = typename std::less<T>>
void theplu::yat::utility::SortedBuffer< T, OutputIterator, Comp >::push ( const T &  t)
inline

Insert an element to the buffer

◆ push() [2/2]

template<typename T, typename OutputIterator, typename Comp = typename std::less<T>>
void theplu::yat::utility::SortedBuffer< T, OutputIterator, Comp >::push ( T &&  t)
inline

Move an element into the buffer

◆ top()

template<typename T, typename OutputIterator, typename Comp = typename std::less<T>>
const T& theplu::yat::utility::SortedBuffer< T, OutputIterator, Comp >::top ( void  ) const
inline
Returns
the smallest element

The documentation for this class was generated from the following file:

Generated on Sat Feb 18 2023 03:31:45 for yat by  doxygen 1.8.14