about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-12-05 18:19:55 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-12-05 18:19:55 +0100
commit25ec91e725bdf495722034a0331c77d45ab9b266 (patch)
treef2e8bcd9fdb734facea637b34f9374596dc7e255
parentdff16e900f2dd3e9e257a015d22bec6b73529cc7 (diff)
downloadadventofcode2017-25ec91e725bdf495722034a0331c77d45ab9b266.tar.gz
adventofcode2017-25ec91e725bdf495722034a0331c77d45ab9b266.tar.xz
adventofcode2017-25ec91e725bdf495722034a0331c77d45ab9b266.zip
day03: use a proper C++17 sentinel value for infinity
-rw-r--r--day03.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/day03.cc b/day03.cc
index efaffc0..fef7c92 100644
--- a/day03.cc
+++ b/day03.cc
@@ -7,6 +7,7 @@
 using namespace std;
 
 class SpiralIterator : public std::iterator<std::input_iterator_tag, int> {
+	struct SpiralInfinity { };
 public:
 	pair<int, int> p;
 	int i, j, d;
@@ -15,8 +16,8 @@ public:
 	{ }
 
 	auto begin() { return *this; }
-	auto end() { return SpiralIterator{}; }
-	bool operator!=(SpiralIterator &) const { return true; }   // infinite
+	auto end() { return SpiralInfinity{}; }
+	bool operator!=(SpiralInfinity) const { return true; }   // infinite
 
 	auto operator*() { return p; }
 	auto operator++() {