[PATCH] D35043: [ADT] Enable reverse iteration for DenseMap

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 30 19:10:05 PDT 2017


On Sun, Jul 30, 2017 at 7:06 PM Mandeep Singh Grang via Phabricator <
reviews at reviews.llvm.org> wrote:

> mgrang added a comment.
>
> > Was it not possible to use something more like what I'd suggested - that
> would've worked (I think) with PointerLikeTypeTraits? Or did that not seem
> to work out?
>
> Sounded like Richard had an idea of how to do it even more simply than my
> suggestion, maybe... (if we removed the base definition of
> PointerLikeTypeTraits & were able to test on the completeness of the class,
> rather than checking for the specific member as I'd done)
>
> @dblaikie I tried both ways. Checking is_pointer on a PointerLikeTypeTrait
> I again ran into compile errors due to incomplete types (similar to the
> ones I had mentioned earlier).
> I tried removing the base defintion of PointerLikeTypeTraits but ran into
> more compile errors (because now there is no sink for a T which is not
> specialized?). Like:
>
>   error: cannot initialize return object of type 'llvm::cl::OptionCategory
> *const' with an rvalue of type 'llvm::cl::OptionCategory **'
>         return PtrTraits::getFromVoidPointer(const_cast<void
> *>(Bucket[-1]));
>
> Also about using SFINAE to check type completeness, this thread states
> that it's possible but would be broken (what if the type is completed after
> the point you query it?):
>
> https://stackoverflow.com/questions/21119281/using-sfinae-to-check-if-the-type-is-complete-or-not


I'm pretty sure that's OK in this case - since the same rule is already
true for specializations (you can't rely on the implicit specialization
when you have an explicit specialization (of PointerLikeTypeTraits)) - so
this won't be declared & become complete later, etc, I think... ?


>
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D35043
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170731/7a10553e/attachment.html>


More information about the llvm-commits mailing list