Skip to content

Commit

Permalink
explicit irange constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
kentslaney committed Feb 7, 2024
1 parent 36f1644 commit ccd20a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/ClientPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class irange {
using difference_type = int;
using iterator_category = std::random_access_iterator_tag;

irange(int i) : i(i) {}
explicit irange(int i) : i(i) {}

reference operator*() const { return i; }
pointer operator->() const { return &i; }
Expand All @@ -55,7 +55,7 @@ class irange {
irange& operator-=(difference_type n) { i -= n; return *this; }
friend irange operator+(const irange& lhs, difference_type n) { irange tmp = lhs; tmp += n; return tmp; }
friend irange operator+(difference_type n, const irange& rhs) { return rhs + n; }
friend irange operator-(const irange& lhs, difference_type n) { return lhs.i + (-n); }
friend irange operator-(const irange& lhs, difference_type n) { irange tmp = lhs; tmp -= n; return tmp; }
friend difference_type operator-(const irange& lhs, const irange& rhs) { return lhs.i - rhs.i; }
};

Expand Down

0 comments on commit ccd20a5

Please sign in to comment.