[PATCH] D35043: [ADT] Enable reverse iteration for DenseMap
Mandeep Singh Grang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 6 11:52:24 PDT 2017
mgrang added inline comments.
================
Comment at: include/llvm/Support/PointerLikeTypeTraits.h:35
+// Trait to check if T is pointer.
+template<typename T>
+struct is_pointer { static const bool value = false; };
----------------
mgrang wrote:
> Just checking if T is a complete type is not enough due to the presence of specialization for const T:
> template <typename T> class PointerLikeTypeTraits<const T>
>
> In this case, for a const int the type is complete but it's not a pointer type. So to handle such cases I had to check for is_pointer too.
We might as well not check for is_complete and just check for is_pointer, and then add more specialization for is_pointer of other ptr types (like shared, unique ptr, etc)?
Repository:
rL LLVM
https://reviews.llvm.org/D35043
More information about the llvm-commits
mailing list