cmAlgorithms: Move cmRotate out of 'implementation detail' namespace.

This should be generally usable in cmake.
This commit is contained in:
Stephen Kelly 2015-02-15 23:39:38 +01:00
parent 8ed6ecac3f
commit 09d6125bfe
1 changed files with 11 additions and 11 deletions

View File

@ -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>