[PATCH] D58088: [adt] Add raw_pointer_iterator to iterate over std::unique_ptr<> collections
Daniel Sanders via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 13 12:49:45 PST 2019
dsanders added a comment.
In D58088#1395226 <https://reviews.llvm.org/D58088#1395226>, @paquette wrote:
> Hmm, It might be nice to have this as a specialization of `pointer_iterator` if possible.
>
> I think it might be a source of confusion/frustration to have both a `raw_pointer_iterator` and a `pointer_iterator`, where `raw_pointer_iterator` is specifically used for //only// `unique_ptr`.
I can see a way to achieve that (std::to_address()) but it requires C++20. Without that, the closest I've been able to get is a `raw_pointer_iterator` alias to `pointer_iterator` that has specializations based on whether a third optional argument is `true_type` or `false_type`. The main thing I'm missing to fold the alias in is a way to specify the default value of T in a way that resolves to either pointer_iterator's default type T or raw_pointer_iterators default type T depending on whether *Iter is a std::unique_ptr<X>& or not. I can detect the type easily enough but selecting between the two defaults is proving troublesome as it resolves the true and false cases too early and ends up trying to do int::pointer and failing because int isn't a class type.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58088/new/
https://reviews.llvm.org/D58088
More information about the llvm-commits
mailing list