瀏覽代碼

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

Sam Jaffe 2 年之前
父節點
當前提交
e71b0e7b91
共有 1 個文件被更改,包括 6 次插入1 次删除
  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(); }
 };
 }