simplify
This commit is contained in:
parent
ceab9a14cc
commit
c86e71ec09
|
@ -18,17 +18,17 @@ struct Counter
|
||||||
Counter() : n{0} {}
|
Counter() : n{0} {}
|
||||||
Counter(std::size_t n) : n{n} {}
|
Counter(std::size_t n) : n{n} {}
|
||||||
|
|
||||||
|
// prefix increment
|
||||||
auto operator++() -> Counter&
|
auto operator++() -> Counter&
|
||||||
{
|
{
|
||||||
n++;
|
n++;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// postfix increment
|
||||||
auto operator++(int) -> Counter
|
auto operator++(int) -> Counter
|
||||||
{
|
{
|
||||||
auto temp = *this;
|
return n++;
|
||||||
n++;
|
|
||||||
return temp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto operator*() const -> EmptyRef
|
auto operator*() const -> EmptyRef
|
||||||
|
|
Loading…
Reference in New Issue
Block a user