LevelS C++ support library  3.83
Functions
sort_utils.h File Reference
#include <algorithm>
#include <functional>
#include <vector>

Go to the source code of this file.

Functions

template<typename It , typename T2 , typename Comp >
void buildIndex (It begin, It end, std::vector< T2 > &idx, Comp comp)
 
template<typename It , typename T2 >
void buildIndex (It begin, It end, std::vector< T2 > &idx)
 
template<typename It , typename T2 >
void sortByIndex (It begin, It end, const std::vector< T2 > &idx)
 
template<typename It , typename T2 >
void sortByIndex_inplace (It begin, It end, const std::vector< T2 > &idx)
 

Detailed Description

Various helper functions for sorting sequences.

Copyright (C) 2002-2015 Max-Planck-Society

Author
Martin Reinecke

Definition in file sort_utils.h.

Function Documentation

◆ buildIndex() [1/2]

template<typename It , typename T2 , typename Comp >
void buildIndex ( It  begin,
It  end,
std::vector< T2 > &  idx,
Comp  comp 
)
inline

Performs an indirect sort on the supplied iterator range and returns in idx a vector containing the indices of the smallest, second smallest, third smallest, etc. element, according to comp.

Definition at line 54 of file sort_utils.h.

◆ buildIndex() [2/2]

template<typename It , typename T2 >
void buildIndex ( It  begin,
It  end,
std::vector< T2 > &  idx 
)
inline

Performs an indirect sort on the supplied iterator range and returns in idx a vector containing the indices of the smallest, second smallest, third smallest, etc. element.

Definition at line 66 of file sort_utils.h.

◆ sortByIndex()

template<typename It , typename T2 >
void sortByIndex ( It  begin,
It  end,
const std::vector< T2 > &  idx 
)
inline

Sorts the supplied iterator range according to the order given by idx. The operation is done out of place and requires temporary extra storage.

Definition at line 76 of file sort_utils.h.

◆ sortByIndex_inplace()

template<typename It , typename T2 >
void sortByIndex_inplace ( It  begin,
It  end,
const std::vector< T2 > &  idx 
)
inline

Sorts the supplied iterator range according to the order given by idx. The operation is done in place.

Definition at line 91 of file sort_utils.h.


Generated on Wed Nov 13 2024 12:18:16 for LevelS C++ support library