cmAlgorithms: Add const to const objects.

This commit is contained in:
Stephen Kelly 2015-02-20 21:52:09 +01:00
parent 7e576624bb
commit cb75eec0b4
1 changed files with 3 additions and 3 deletions

View File

@ -84,7 +84,7 @@ private:
template<typename FwdIt> template<typename FwdIt>
FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last) FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last)
{ {
typename std::iterator_traits<FwdIt>::difference_type dist = const typename std::iterator_traits<FwdIt>::difference_type dist =
std::distance(middle, last); std::distance(middle, last);
std::rotate(first, middle, last); std::rotate(first, middle, last);
std::advance(first, dist); std::advance(first, dist);
@ -204,7 +204,7 @@ std::string cmJoin(Range const& r, const char* delimiter)
std::ostringstream os; std::ostringstream os;
typedef typename Range::value_type ValueType; typedef typename Range::value_type ValueType;
typedef typename Range::const_iterator InputIt; typedef typename Range::const_iterator InputIt;
InputIt first = r.begin(); const InputIt first = r.begin();
InputIt last = r.end(); InputIt last = r.end();
--last; --last;
std::copy(first, last, std::copy(first, last,
@ -260,7 +260,7 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r)
for(typename Range::const_iterator it = r.begin(); for(typename Range::const_iterator it = r.begin();
it != r.end(); ++it, ++count) it != r.end(); ++it, ++count)
{ {
typename Range::iterator low = const typename Range::iterator low =
std::lower_bound(unique.begin(), unique.end(), *it); std::lower_bound(unique.begin(), unique.end(), *it);
if (low == unique.end() || *low != *it) if (low == unique.end() || *low != *it)
{ {