Bladeren bron

fix: fix bugs in the construction of sentinel_iterator, and with unbound iteration

Sam Jaffe 2 jaren geleden
bovenliggende
commit
e71b0e7b91
1 gewijzigde bestanden met toevoegingen van 6 en 1 verwijderingen
  1. 6 1
      include/iterator/sentinel_iterator.h

+ 6 - 1
include/iterator/sentinel_iterator.h

@@ -15,11 +15,16 @@ namespace iterator {
 template <typename It, typename S>
 class sentinel_iterator : public proxy<It, sentinel_iterator<It, S>> {
 public:
-  using super_t = proxy<It, sentinel_iterator<It>>;
+  using super_t = proxy<It, sentinel_iterator<It, S>>;
   using sentinel_type = sentinel_iterator;
 
 public:
   using super_t::super_t;
+  sentinel_iterator(S) : super_t() {}
+
+  bool equal_to(sentinel_iterator const & other) const {
+    return (at_end() && other.at_end()) || super_t::impl() == other.impl();
+  }
   bool at_end() const { return super_t::impl() == S(); }
 };
 }