diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-02-15 22:39:38 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-02-20 20:36:58 (GMT) |
commit | 09d6125bfe4034f332956f4bcc5b0a1ba0b82e27 (patch) | |
tree | eb95f36492e9b0a621a0f7cff74ebe0c168b8688 /Source | |
parent | 8ed6ecac3fb0f832333e2d5d6f3551ab8e335d0f (diff) | |
download | CMake-09d6125bfe4034f332956f4bcc5b0a1ba0b82e27.zip CMake-09d6125bfe4034f332956f4bcc5b0a1ba0b82e27.tar.gz CMake-09d6125bfe4034f332956f4bcc5b0a1ba0b82e27.tar.bz2 |
cmAlgorithms: Move cmRotate out of 'implementation detail' namespace.
This should be generally usable in cmake.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmAlgorithms.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 43e113b..30a062a 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -81,6 +81,16 @@ private: const std::string m_test; }; +template<typename BiDirIt> +BiDirIt cmRotate(BiDirIt first, BiDirIt middle, BiDirIt last) +{ + typename std::iterator_traits<BiDirIt>::difference_type dist = + std::distance(first, middle); + std::rotate(first, middle, last); + std::advance(last, -dist); + return last; +} + namespace ContainerAlgorithms { template<typename T> @@ -138,20 +148,10 @@ private: const_iterator End; }; -template<typename BiDirIt> -BiDirIt Rotate(BiDirIt first, BiDirIt middle, BiDirIt last) -{ - typename std::iterator_traits<BiDirIt>::difference_type dist = - std::distance(first, middle); - std::rotate(first, middle, last); - std::advance(last, -dist); - return last; -} - template<typename Iter> Iter RemoveN(Iter i1, Iter i2, size_t n) { - return ContainerAlgorithms::Rotate(i1, i1 + n, i2); + return cmRotate(i1, i1 + n, i2); } template<typename Range> |