Public Member Functions | Public Attributes
mbl_index_sort_cmp< T, INDEX, CONT, CMP > Struct Template Reference

A comparator for general index sorting. More...

#include <mbl_index_sort.h>

List of all members.

Public Member Functions

 mbl_index_sort_cmp (const CONT &data, const CMP &c=CMP())
bool operator() (const INDEX &a, const INDEX &b) const

Public Attributes

const CONT & data_
const CMP & cmp_

Detailed Description

template<class T, class INDEX = unsigned, class CONT = vcl_vector<T>, class CMP = vcl_less<T>>
struct mbl_index_sort_cmp< T, INDEX, CONT, CMP >

A comparator for general index sorting.

It will take any type of index on to any sort of container so long as T container.operator[](index) const is defined.

For example, a simple index sort can be done as follows.

  vcl_vector<double> data (n);
  vcl_vector<unsigned> index (n/2);
  ...
  vcl_sort(index.begin(), index.end(), mbl_index_sort_cmp<double>(data));

Definition at line 106 of file mbl_index_sort.h.


Constructor & Destructor Documentation

template<class T , class INDEX = unsigned, class CONT = vcl_vector<T>, class CMP = vcl_less<T>>
mbl_index_sort_cmp< T, INDEX, CONT, CMP >::mbl_index_sort_cmp ( const CONT &  data,
const CMP &  c = CMP() 
) [inline, explicit]

Definition at line 108 of file mbl_index_sort.h.


Member Function Documentation

template<class T , class INDEX = unsigned, class CONT = vcl_vector<T>, class CMP = vcl_less<T>>
bool mbl_index_sort_cmp< T, INDEX, CONT, CMP >::operator() ( const INDEX &  a,
const INDEX &  b 
) const [inline]

Definition at line 112 of file mbl_index_sort.h.


Member Data Documentation

template<class T , class INDEX = unsigned, class CONT = vcl_vector<T>, class CMP = vcl_less<T>>
const CMP& mbl_index_sort_cmp< T, INDEX, CONT, CMP >::cmp_

Definition at line 111 of file mbl_index_sort.h.

template<class T , class INDEX = unsigned, class CONT = vcl_vector<T>, class CMP = vcl_less<T>>
const CONT& mbl_index_sort_cmp< T, INDEX, CONT, CMP >::data_

Definition at line 110 of file mbl_index_sort.h.


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