[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
Mon Jul 27 11:58:53 PDT 2020


jdh8 created this revision.
Herald added subscribers: llvm-commits, dexonsmith.
Herald added a project: LLVM.

This change is needed to apply generic algorithmic functions (like in
STLExtras.h) to the result of SmallBitVector::set_bits


Repository:
  rG LLVM Github Monorepo

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::forward_iterator_tag,
+          unsigned, std::ptrdiff_t, const unsigned *, const unsigned &> {
   const BitVectorT &Parent;
   int Current = 0;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84690.281008.patch
Type: text/x-patch
Size: 697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200727/9986d506/attachment.bin>


More information about the llvm-commits mailing list