From 248f3102153a457d7f7058ef45405d8b1376bc1a Mon Sep 17 00:00:00 2001 From: Francois Chabot Date: Thu, 28 May 2020 10:14:55 -0400 Subject: [PATCH] cleaned up custom iterator example --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fb793ab2..dfd5932e 100644 --- a/README.md +++ b/README.md @@ -454,7 +454,7 @@ struct MyIterator { } bool operator!=(const MyIterator& rhs) const { - return rhs.pos != pos || rhs.target != target; + return rhs.target != target; } reference operator*() const { @@ -462,15 +462,14 @@ struct MyIterator { } MyContainer* target = nullptr; - std::size_t pos = 0; }; MyIterator begin(MyContainer& tgt) { - return MyIterator{&tgt, 0} + return MyIterator{&tgt}; } MyIterator end(const MyContainer&) { - return MyIterator{nullptr, 0} + return {}; } void foo() {