Use numeric_limits<size_t>::max() instead of size_t(-1).

llvm-svn: 297641
This commit is contained in:
Zachary Turner 2017-03-13 17:12:37 +00:00
parent 4eb8449d6c
commit 326b4fe7f7
1 changed files with 5 additions and 2 deletions

View File

@ -1024,6 +1024,9 @@ class enumerator_iter
using result_type = result_pair<R>; using result_type = result_pair<R>;
public: public:
explicit enumerator_iter(IterOfRange<R> EndIter)
: Result(std::numeric_limits<size_t>::max(), EndIter) { }
enumerator_iter(std::size_t Index, IterOfRange<R> Iter) enumerator_iter(std::size_t Index, IterOfRange<R> Iter)
: Result(Index, Iter) {} : Result(Index, Iter) {}
@ -1031,7 +1034,7 @@ public:
const result_type &operator*() const { return Result; } const result_type &operator*() const { return Result; }
enumerator_iter<R> &operator++() { enumerator_iter<R> &operator++() {
assert(Result.Index != size_t(-1)); assert(Result.Index != std::numeric_limits<size_t>::max());
++Result.Iter; ++Result.Iter;
++Result.Index; ++Result.Index;
return *this; return *this;
@ -1061,7 +1064,7 @@ public:
return enumerator_iter<R>(0, std::begin(TheRange)); return enumerator_iter<R>(0, std::begin(TheRange));
} }
enumerator_iter<R> end() { enumerator_iter<R> end() {
return enumerator_iter<R>(-1, std::end(TheRange)); return enumerator_iter<R>(std::end(TheRange));
} }
private: private: