|
template<typename ExtIterator_ , typename KeyExtractor_ > |
void | ksort (ExtIterator_ first_, ExtIterator_ last_, KeyExtractor_ keyobj, unsigned_type M__) |
| Sort records with integer keys. More...
|
|
template<typename ExtIterator_ > |
void | ksort (ExtIterator_ first_, ExtIterator_ last_, unsigned_type M__) |
| Sort records with integer keys. More...
|
|
template<typename ExtIterator_ , typename RandomNumberGenerator_ , unsigned BlockSize_, unsigned PageSize_, typename AllocStrategy_ > |
void | random_shuffle (ExtIterator_ first, ExtIterator_ last, RandomNumberGenerator_ &rand, unsigned_type M, AllocStrategy_ AS=STXXL_DEFAULT_ALLOC_STRATEGY()) |
| External equivalent of std::random_shuffle. More...
|
|
template<typename Tp_ , typename AllocStrategy_ , typename SzTp_ , typename DiffTp_ , unsigned BlockSize_, typename PgTp_ , unsigned PageSize_, typename RandomNumberGenerator_ > |
void | random_shuffle (stxxl::vector_iterator< Tp_, AllocStrategy_, SzTp_, DiffTp_, BlockSize_, PgTp_, PageSize_ > first, stxxl::vector_iterator< Tp_, AllocStrategy_, SzTp_, DiffTp_, BlockSize_, PgTp_, PageSize_ > last, RandomNumberGenerator_ &rand, unsigned_type M) |
| External equivalent of std::random_shuffle (specialization for stxxl::vector) More...
|
|
template<typename Tp_ , typename AllocStrategy_ , typename SzTp_ , typename DiffTp_ , unsigned BlockSize_, typename PgTp_ , unsigned PageSize_> |
void | random_shuffle (stxxl::vector_iterator< Tp_, AllocStrategy_, SzTp_, DiffTp_, BlockSize_, PgTp_, PageSize_ > first, stxxl::vector_iterator< Tp_, AllocStrategy_, SzTp_, DiffTp_, BlockSize_, PgTp_, PageSize_ > last, unsigned_type M) |
| External equivalent of std::random_shuffle (specialization for stxxl::vector) More...
|
|
template<typename _ExtIterator , typename _UnaryFunction > |
_UnaryFunction | for_each (_ExtIterator _begin, _ExtIterator _end, _UnaryFunction _functor, int_type nbuffers) |
| External equivalent of std::for_each. More...
|
|
template<typename _ExtIterator , typename _UnaryFunction > |
_UnaryFunction | for_each_m (_ExtIterator _begin, _ExtIterator _end, _UnaryFunction _functor, int_type nbuffers) |
| External equivalent of std::for_each (mutating) More...
|
|
template<typename _ExtIterator , typename _Generator > |
void | generate (_ExtIterator _begin, _ExtIterator _end, _Generator _generator, int_type nbuffers) |
| External equivalent of std::generate. More...
|
|
template<typename _ExtIterator , typename _EqualityComparable > |
_ExtIterator | find (_ExtIterator _begin, _ExtIterator _end, const _EqualityComparable &_value, int_type nbuffers) |
| External equivalent of std::find. More...
|
|
template<typename ExtIterator_ , typename StrictWeakOrdering_ > |
void | sort (ExtIterator_ first, ExtIterator_ last, StrictWeakOrdering_ cmp, unsigned_type M) |
| Sort records comparison-based. More...
|
|
template<typename ExtIterator_ > |
void | stable_ksort (ExtIterator_ first, ExtIterator_ last, unsigned_type M) |
| Sort records with integer keys. More...
|
|
template<unsigned BlockSize, class RandomAccessIterator , class CmpType , class AllocStr > |
void | sort (RandomAccessIterator begin, RandomAccessIterator end, CmpType cmp, unsigned_type MemSize, AllocStr AS) |
| Sorts range of any random access iterators externally. More...
|
|
Model of
Key extractor concept must:
- define type key_type ,
- provide operator() that returns key value of an object of user type
- provide max_value method that returns a value that is strictly greater than all other objects of user type in respect to the key obtained by this key extractor ,
- provide min_value method that returns a value that is strictly less than all other objects of user type in respect to the key obtained by this key extractor ,
- operator > , operator <, operator == and operator != on type key_type must be defined.
- Note: when using unsigned integral types as key, the value 0 cannot be used as a key value because it would conflict with the sentinel value returned by min_value
Example: extractor class
GetWeight, that extracts weight from an
Edge
struct Edge
{
unsigned src,dest,weight;
Edge(unsigned s,unsigned d,unsigned w):src(s),dest(d),weight(w){}
};
struct GetWeight
{
typedef unsigned key_type;
key_type operator() (const Edge & e) const
{
return e.weight;
}
Edge min_value() const { return Edge(0,0,(std::numeric_limits<key_type>::min)()); };
Edge max_value() const { return Edge(0,0,(std::numeric_limits<key_type>::max)()); };
};
Model of
Comparison concept must:
- provide operator(a,b) that returns comparison result of two user types, must define strict weak ordering
- provide max_value method that returns a value that is strictly greater than all other objects of user type,
- provide min_value method that returns a value that is strictly less than all other objects of user type,
- Note: when using unsigned integral types as key in user types, the value 0 cannot be used as a key value of the data to be sorted because it would conflict with the sentinel value returned by min_value
Example: comparator class
my_less_int
struct my_less_int
{
bool operator() (int a, int b) const
{
return a < b;
}
int min_value() const { return std::numeric_limits<int>::min(); };
int max_value() const { return std::numeric_limits<int>::max(); };
};
Example: comparator class
my_less, could be instantiated as e.g.
my_less<int> ,
my_less<unsigned long> , ...
template <typename Tp>
struct my_less
{
typedef Tp value_type;
bool operator() (const value_type & a, const value_type & b) const
{
return a < b;
}
value_type min_value() const { return std::numeric_limits<value_type>::min(); };
value_type max_value() const { return std::numeric_limits<value_type>::max(); };
};