From 09d6125bfe4034f332956f4bcc5b0a1ba0b82e27 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Feb 2015 23:39:38 +0100 Subject: [PATCH] cmAlgorithms: Move cmRotate out of 'implementation detail' namespace. This should be generally usable in cmake. --- Source/cmAlgorithms.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 43e113b3a..30a062a45 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -81,6 +81,16 @@ private: const std::string m_test; }; +template +BiDirIt cmRotate(BiDirIt first, BiDirIt middle, BiDirIt last) +{ + typename std::iterator_traits::difference_type dist = + std::distance(first, middle); + std::rotate(first, middle, last); + std::advance(last, -dist); + return last; +} + namespace ContainerAlgorithms { template @@ -138,20 +148,10 @@ private: const_iterator End; }; -template -BiDirIt Rotate(BiDirIt first, BiDirIt middle, BiDirIt last) -{ - typename std::iterator_traits::difference_type dist = - std::distance(first, middle); - std::rotate(first, middle, last); - std::advance(last, -dist); - return last; -} - template Iter RemoveN(Iter i1, Iter i2, size_t n) { - return ContainerAlgorithms::Rotate(i1, i1 + n, i2); + return cmRotate(i1, i1 + n, i2); } template