do you have some efficient routine for returning array with indices for sorted elements in a array? I think that some convenient way exists using stl vector. Do you have alr
You could try something like this:
template class index_sorter { public: compare(C const& c) : c(c) {} bool operator()(std::size_t const& lhs, std::size_t const& rhs) const { return c[lhs] < c[rhs]; } private: C const& c; }; std::sort(index_vector.begin(), index_vector.end(), index_sorter(vector));