cmAlgorithms: Move cmRotate out of 'implementation detail' namespace.
This should be generally usable in cmake.
This commit is contained in:
parent
8ed6ecac3f
commit
09d6125bfe
@ -81,6 +81,16 @@ private:
|
|||||||
const std::string m_test;
|
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 {
|
namespace ContainerAlgorithms {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -138,20 +148,10 @@ private:
|
|||||||
const_iterator End;
|
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>
|
template<typename Iter>
|
||||||
Iter RemoveN(Iter i1, Iter i2, size_t n)
|
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>
|
template<typename Range>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user