CMR  1.3.0
Public Member Functions | List of all members
tu::vector_less< T, Less > Struct Template Reference

#include <comparators.hpp>

Public Member Functions

 vector_less (const std::vector< T > &data, Less less=Less())
 
bool operator() (size_t i, size_t j)
 

Detailed Description

template<typename T, typename Less = std::less <T>>
struct tu::vector_less< T, Less >

A wrapper for an element-comparator which can be used to sort an indirection vector according to the data it points to.

Constructor & Destructor Documentation

◆ vector_less()

template<typename T , typename Less = std::less <T>>
tu::vector_less< T, Less >::vector_less ( const std::vector< T > &  data,
Less  less = Less() 
)
inline

Constructs the comparator.

Parameters
dataThe vector
lessAn optional element-comparator

Member Function Documentation

◆ operator()()

template<typename T , typename Less = std::less <T>>
bool tu::vector_less< T, Less >::operator() ( size_t  i,
size_t  j 
)
inline

Compares two indices by comparing their elements.

Parameters
iFirst index
jSecond index
Returns
true if and only if the element at the first index is smaller than the element at the second index

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