Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::gtl::TopN< T, Cmp > Class Template Reference

Detailed Description

template<class T, class Cmp = std::greater<T>>
class operations_research::gtl::TopN< T, Cmp >

Definition at line 50 of file top_n.h.

#include <top_n.h>

Public Types

enum  State { UNORDERED , BOTTOM_KNOWN , HEAP_SORTED }
using UnsortedIterator = typename std::vector<T>::const_iterator

Public Member Functions

 TopN (size_t limit)
 TopN (size_t limit, const Cmp &cmp)
size_t limit () const
size_t size () const
bool empty () const
void reserve (size_t n)
void push (const T &v)
void push (const T &v, T *dropped)
void push (T &&v)
void push (T &&v, T *dropped)
const T & peek_bottom ()
std::vector< T > Take ()
std::vector< T > * Extract ()
std::vector< T > * ExtractUnsorted ()
std::vector< T > * ExtractNondestructive () const
void ExtractNondestructive (std::vector< T > *output) const
std::vector< T > * ExtractUnsortedNondestructive () const
void ExtractUnsortedNondestructive (std::vector< T > *output) const
UnsortedIterator unsorted_begin () const
UnsortedIterator unsorted_end () const
Cmp * comparator ()
void Reset ()

Member Typedef Documentation

◆ UnsortedIterator

template<class T, class Cmp = std::greater<T>>
using operations_research::gtl::TopN< T, Cmp >::UnsortedIterator = typename std::vector<T>::const_iterator

Definition at line 76 of file top_n.h.

Member Enumeration Documentation

◆ State

template<class T, class Cmp = std::greater<T>>
enum operations_research::gtl::TopN::State
Enumerator
UNORDERED 
BOTTOM_KNOWN 
HEAP_SORTED 

Definition at line 75 of file top_n.h.

Constructor & Destructor Documentation

◆ TopN() [1/2]

template<class T, class Cmp = std::greater<T>>
operations_research::gtl::TopN< T, Cmp >::TopN ( size_t limit)
inlineexplicit

Definition at line 78 of file top_n.h.

◆ TopN() [2/2]

template<class T, class Cmp = std::greater<T>>
operations_research::gtl::TopN< T, Cmp >::TopN ( size_t limit,
const Cmp & cmp )
inline

Definition at line 79 of file top_n.h.

Member Function Documentation

◆ comparator()

template<class T, class Cmp = std::greater<T>>
Cmp * operations_research::gtl::TopN< T, Cmp >::comparator ( )
inline

Definition at line 155 of file top_n.h.

◆ empty()

template<class T, class Cmp = std::greater<T>>
bool operations_research::gtl::TopN< T, Cmp >::empty ( ) const
inline

Definition at line 84 of file top_n.h.

◆ Extract()

template<class T, class Cmp>
std::vector< T > * operations_research::gtl::TopN< T, Cmp >::Extract ( )

Definition at line 268 of file top_n.h.

◆ ExtractNondestructive() [1/2]

template<class T, class Cmp>
std::vector< T > * operations_research::gtl::TopN< T, Cmp >::ExtractNondestructive ( ) const

Definition at line 290 of file top_n.h.

◆ ExtractNondestructive() [2/2]

template<class T, class Cmp>
void operations_research::gtl::TopN< T, Cmp >::ExtractNondestructive ( std::vector< T > * output) const

Definition at line 296 of file top_n.h.

◆ ExtractUnsorted()

template<class T, class Cmp>
std::vector< T > * operations_research::gtl::TopN< T, Cmp >::ExtractUnsorted ( )

Definition at line 280 of file top_n.h.

◆ ExtractUnsortedNondestructive() [1/2]

template<class T, class Cmp>
std::vector< T > * operations_research::gtl::TopN< T, Cmp >::ExtractUnsortedNondestructive ( ) const

Definition at line 307 of file top_n.h.

◆ ExtractUnsortedNondestructive() [2/2]

template<class T, class Cmp>
void operations_research::gtl::TopN< T, Cmp >::ExtractUnsortedNondestructive ( std::vector< T > * output) const

Definition at line 313 of file top_n.h.

◆ limit()

template<class T, class Cmp = std::greater<T>>
size_t operations_research::gtl::TopN< T, Cmp >::limit ( ) const
inline

Definition at line 80 of file top_n.h.

◆ peek_bottom()

template<class T, class Cmp>
const T & operations_research::gtl::TopN< T, Cmp >::peek_bottom ( )

Definition at line 234 of file top_n.h.

◆ push() [1/4]

template<class T, class Cmp = std::greater<T>>
void operations_research::gtl::TopN< T, Cmp >::push ( const T & v)
inline

Definition at line 94 of file top_n.h.

◆ push() [2/4]

template<class T, class Cmp = std::greater<T>>
void operations_research::gtl::TopN< T, Cmp >::push ( const T & v,
T * dropped )
inline

Definition at line 95 of file top_n.h.

◆ push() [3/4]

template<class T, class Cmp = std::greater<T>>
void operations_research::gtl::TopN< T, Cmp >::push ( T && v)
inline

Definition at line 98 of file top_n.h.

◆ push() [4/4]

template<class T, class Cmp = std::greater<T>>
void operations_research::gtl::TopN< T, Cmp >::push ( T && v,
T * dropped )
inline

Definition at line 101 of file top_n.h.

◆ reserve()

template<class T, class Cmp = std::greater<T>>
void operations_research::gtl::TopN< T, Cmp >::reserve ( size_t n)
inline

Definition at line 88 of file top_n.h.

◆ Reset()

template<class T, class Cmp>
void operations_research::gtl::TopN< T, Cmp >::Reset ( )

Definition at line 322 of file top_n.h.

◆ size()

template<class T, class Cmp = std::greater<T>>
size_t operations_research::gtl::TopN< T, Cmp >::size ( ) const
inline

Definition at line 83 of file top_n.h.

◆ Take()

template<class T, class Cmp>
std::vector< T > operations_research::gtl::TopN< T, Cmp >::Take ( )

Definition at line 255 of file top_n.h.

◆ unsorted_begin()

template<class T, class Cmp = std::greater<T>>
UnsortedIterator operations_research::gtl::TopN< T, Cmp >::unsorted_begin ( ) const
inline

Definition at line 152 of file top_n.h.

◆ unsorted_end()

template<class T, class Cmp = std::greater<T>>
UnsortedIterator operations_research::gtl::TopN< T, Cmp >::unsorted_end ( ) const
inline

Definition at line 153 of file top_n.h.


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