Changeset 3542


Ignore:
Timestamp:
Dec 23, 2016, 8:02:24 AM (5 years ago)
Author:
Peter
Message:

fix sort_index so it works with iterators that are boost::random_access_traversal_tag but not std::random_access_iterator_tag. refs #803

File:
1 edited

Legend:

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

    r3417 r3542  
    104104    void sort_index(InputIterator first, InputIterator last,
    105105                    std::vector<size_t>& idx, Compare comp,
    106                     boost::single_pass_traversal_tag);
     106                    std::input_iterator_tag);
    107107
    108108    // Specialization for random access iterator
     
    110110    void sort_index(RandomAccessIterator first, RandomAccessIterator last,
    111111                    std::vector<size_t>& idx, Compare comp,
    112                     boost::random_access_traversal_tag);
    113 
     112                    std::random_access_iterator_tag);
    114113
    115114    template<typename RandomAccessIterator, class Compare>
     
    160159  {
    161160    BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator>));
    162     typename boost::iterator_traversal<InputIterator>::type traversal;
    163     detail::sort_index(first, last, idx, comp, traversal);
     161    typename std::iterator_traits<InputIterator>::iterator_category category;
     162    detail::sort_index(first, last, idx, comp, category);
    164163  }
    165164
     
    173172    void sort_index(InputIterator first, InputIterator last,
    174173                    std::vector<size_t>& idx, Compare comp,
    175                     boost::single_pass_traversal_tag tag)
     174                    std::input_iterator_tag tag)
    176175    {
    177176      typedef typename boost::iterator_value<InputIterator>::type T;
     
    181180      std::vector<T> vec(first, last);
    182181      sort_index(vec.begin(), vec.end(), idx, comp,
    183                  boost::random_access_traversal_tag());
     182                 std::random_access_iterator_tag());
    184183    }
    185184
     
    189188    void sort_index(RandomAccessIterator first, RandomAccessIterator last,
    190189                    std::vector<size_t>& idx, Compare comp,
    191                     boost::random_access_traversal_tag tag)
     190                    std::random_access_iterator_tag tag)
    192191    {
    193192      sort_index_Compare<RandomAccessIterator, Compare> compare(first, comp);
Note: See TracChangeset for help on using the changeset viewer.