This commit is contained in:
Eric Mertens 2023-12-04 17:35:18 -08:00
parent ceab9a14cc
commit c86e71ec09

View File

@ -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