MeshLib Documentation
Loading...
Searching...
No Matches
MR::FewSmallest< T > Class Template Reference

the class stores some number of smallest elements from a larger number of candidates More...

#include <MRFewSmallest.h>

Public Member Functions

 FewSmallest (size_t maxElms=0)
 configure the object to store at most given number of elements
 
void reset (size_t maxElms)
 clears the content and reconfigure the object to store at most given number of elements
 
size_t maxElms () const
 returns the maximum number of elements to be stored here
 
bool empty () const
 returns whether the container is currently empty
 
size_t size () const
 returns current number of stored element
 
bool full () const
 returns whether we have already maximum number of elements stored
 
const std::vector< T > & get () const
 returns the smallest elements found so far
 
const T & top () const
 returns the largest among stored smallest elements
 
const T & topOr (const T &emptyRes) const
 returns the largest among stored smallest elements or given element if this is empty
 
void push (T t)
 considers one more element, storing it if it is within the smallest
 
void clear ()
 removes all stored elements
 

Detailed Description

template<typename T>
class MR::FewSmallest< T >

the class stores some number of smallest elements from a larger number of candidates

Constructor & Destructor Documentation

◆ FewSmallest()

template<typename T >
MR::FewSmallest< T >::FewSmallest ( size_t maxElms = 0)
inlineexplicit

configure the object to store at most given number of elements

Member Function Documentation

◆ clear()

template<typename T >
void MR::FewSmallest< T >::clear ( )
inline

removes all stored elements

◆ empty()

template<typename T >
bool MR::FewSmallest< T >::empty ( ) const
inline

returns whether the container is currently empty

◆ full()

template<typename T >
bool MR::FewSmallest< T >::full ( ) const
inline

returns whether we have already maximum number of elements stored

◆ get()

template<typename T >
const std::vector< T > & MR::FewSmallest< T >::get ( ) const
inline

returns the smallest elements found so far

◆ maxElms()

template<typename T >
size_t MR::FewSmallest< T >::maxElms ( ) const
inline

returns the maximum number of elements to be stored here

◆ push()

template<typename T >
void MR::FewSmallest< T >::push ( T t)

considers one more element, storing it if it is within the smallest

◆ reset()

template<typename T >
void MR::FewSmallest< T >::reset ( size_t maxElms)

clears the content and reconfigure the object to store at most given number of elements

◆ size()

template<typename T >
size_t MR::FewSmallest< T >::size ( ) const
inline

returns current number of stored element

◆ top()

template<typename T >
const T & MR::FewSmallest< T >::top ( ) const
inline

returns the largest among stored smallest elements

◆ topOr()

template<typename T >
const T & MR::FewSmallest< T >::topOr ( const T & emptyRes) const
inline

returns the largest among stored smallest elements or given element if this is empty


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