From b6c04d6dc52ace864bb1f5cd26b65f9b639a39b9 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 30 Oct 2018 15:23:29 -0700 Subject: [PATCH] Make apply_permutation work for C++03. Thanks to @jeking3 for the report. --- include/boost/algorithm/apply_permutation.hpp | 9 +++++---- test/apply_permutation_test.cpp | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/boost/algorithm/apply_permutation.hpp b/include/boost/algorithm/apply_permutation.hpp index c844cfc..b9de0de 100644 --- a/include/boost/algorithm/apply_permutation.hpp +++ b/include/boost/algorithm/apply_permutation.hpp @@ -41,15 +41,16 @@ void apply_permutation(RandomAccessIterator1 item_begin, RandomAccessIterator1 item_end, RandomAccessIterator2 ind_begin, RandomAccessIterator2 ind_end) { - using Diff = typename std::iterator_traits::difference_type; + typedef typename std::iterator_traits::difference_type Diff; + typedef typename std::iterator_traits::difference_type Index; using std::swap; Diff size = std::distance(item_begin, item_end); for (Diff i = 0; i < size; i++) { - auto current = i; + Diff current = i; while (i != ind_begin[current]) { - auto next = ind_begin[current]; + Index next = ind_begin[current]; swap(item_begin[current], item_begin[next]); ind_begin[current] = current; current = next; @@ -75,7 +76,7 @@ apply_reverse_permutation( RandomAccessIterator2 ind_begin, RandomAccessIterator2 ind_end) { - using Diff = typename std::iterator_traits::difference_type; + typedef typename std::iterator_traits::difference_type Diff; using std::swap; Diff length = std::distance(item_begin, item_end); for (Diff i = 0; i < length; i++) diff --git a/test/apply_permutation_test.cpp b/test/apply_permutation_test.cpp index e9ab970..3dbb7e1 100644 --- a/test/apply_permutation_test.cpp +++ b/test/apply_permutation_test.cpp @@ -12,7 +12,6 @@ #include -#define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN #include