[PATCH] D18578: BitVector: Add insert() and erase() methods.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 15:24:52 PDT 2016


On Wed, Mar 30, 2016 at 2:00 PM, Matthias Braun via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> MatzeB added a comment.
>
> In http://reviews.llvm.org/D18578#386549, @dblaikie wrote:
>
> > Test cases?
> >  Got a usage in mind?
>
>
> The concrete usage I have in mind is using a BitVector for Set type
> parameter of a SetVector. This is in the context of
> http://reviews.llvm.org/D18427.
>
> And if you think about it: Even though the class is called a BitVector
> most of the time you really use it more like a set where you insert and
> remove elements from and not like a vector there is no
> BitVector::push_back() or iterators after all. So having operations
> compatible with std::set and DenseSet makes sense.
>

This seems like it might be confusing/problematic given the existing
BitVector API. Consider "size" returns the number of bits, not the number
of set bits, I think - right? So that'd be confusing/incorrect to erase an
element yet the size would not change.

If we're going to make this have set-like semantics, we should probably
rename it and assess the whole API for consistency.

- Dave


>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D18578
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160331/73d756a9/attachment.html>


More information about the llvm-commits mailing list