[PATCH] D58421: Add partial implementation of std::to_address() as llvm::to_address()
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 21 09:24:05 PST 2019
dblaikie added inline comments.
================
Comment at: llvm/trunk/include/llvm/ADT/STLExtras.h:1582-1583
+/// The late bound return should be removed once we move to C++14 to better
+/// align with the C++20 declaration. Also, this implementation can be removed
+/// once we move to C++20 where it's defined as std::to_addres()
+///
----------------
glenjofe wrote:
> Is this necessary because you do not have access to `__to_raw_pointer()` in libc++? That is available in pre-C++20. The actual implementation of `std::to_address()` in libc++ is what I implemented in `__to_raw_pointer()` in D35470.
Yeah, this code needs to be portable to other compilers and standard libraries (LLVM can be built with a bunch of different compilers).
================
Comment at: llvm/trunk/include/llvm/ADT/STLExtras.h:1588
+template <class Ptr> auto to_address(const Ptr &P) -> decltype(P.operator->()) {
+ return P.operator->();
+}
----------------
glenjofe wrote:
> The fancy pointer overload should return `to_address(p.operator->())` but this returns `p.operator->()`.
What sort of cases would this support (trying to think of what test coverage to add)?
I guess a multiply-indirect smart pointer? Pretty rare beast, not sure we'd really care/need to support that for LLVM's uses?
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58421/new/
https://reviews.llvm.org/D58421
More information about the llvm-commits
mailing list