[PATCH] D84690: Make iterators of BitVector easier to use by inheriting iterator_facade_base
Chen-Pang He via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 28 00:49:05 PDT 2020
jdh8 updated this revision to Diff 281132.
jdh8 added a comment.
This revision is now accepted and ready to land.
BitVector's iterator should be an input iterator instead of a forward iterator
because it is bound to no `unsigned` object
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84690/new/
https://reviews.llvm.org/D84690
Files:
llvm/include/llvm/ADT/BitVector.h
Index: llvm/include/llvm/ADT/BitVector.h
===================================================================
--- llvm/include/llvm/ADT/BitVector.h
+++ llvm/include/llvm/ADT/BitVector.h
@@ -29,7 +29,11 @@
/// ForwardIterator for the bits that are set.
/// Iterators get invalidated when resize / reserve is called.
-template <typename BitVectorT> class const_set_bits_iterator_impl {
+template <typename BitVectorT>
+class const_set_bits_iterator_impl
+ : public iterator_facade_base<const_set_bits_iterator_impl<BitVectorT>,
+ std::input_iterator_tag, unsigned,
+ std::ptrdiff_t, const unsigned *, unsigned> {
const BitVectorT &Parent;
int Current = 0;
@@ -43,7 +47,6 @@
: Parent(Parent), Current(Current) {}
explicit const_set_bits_iterator_impl(const BitVectorT &Parent)
: const_set_bits_iterator_impl(Parent, Parent.find_first()) {}
- const_set_bits_iterator_impl(const const_set_bits_iterator_impl &) = default;
const_set_bits_iterator_impl operator++(int) {
auto Prev = *this;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84690.281132.patch
Type: text/x-patch
Size: 1091 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200728/526c33d4/attachment.bin>
More information about the llvm-commits
mailing list