Ignore:
Timestamp:
Sep 12, 2008, 3:15:53 AM (13 years ago)
Author:
Peter
Message:

fixes #439

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/sort_index.h

    r1491 r1492  
    2727#include <gsl/gsl_sort.h>
    2828
     29#include <algorithm>
     30#include <iterator>
    2931#include <vector>
    3032
     
    7779
    7880
     81  //  template implementation
     82
     83  template<typename ForwardIterator>
     84  void sort_index(ForwardIterator first, ForwardIterator last,
     85                  std::vector<size_t>& result)
     86  {
     87    std::vector<double> vec;
     88    vec.reserve(std::distance(first, last));
     89    std::copy(first, last,
     90              std::back_insert_iterator<std::vector<double> >(vec));
     91    sort_index(vec.begin(), vec.end(), result);
     92  }
    7993
    8094}}} // of namespace utility, yat, and theplu
Note: See TracChangeset for help on using the changeset viewer.