[PATCH] D54485: [libcxx] Implement P0318R1: unwrap_ref_decay and unwrap_reference

Marshall Clow via Phabricator reviews at reviews.llvm.org
Tue Nov 27 13:01:41 PST 2018


mclow.lists added a comment.

I agree with your concerns about this living in `<utility>`, but as long as people can get it by including `<type_traits>`, then we're good.



================
Comment at: libcxx/include/functional:2536
+#if _LIBCPP_STD_VER > 17
+using __detail::unwrap_reference;
+using __detail::unwrap_ref_decay;
----------------
ldionne wrote:
> EricWF wrote:
> > ldionne wrote:
> > > Is this a viable implementation strategy? The nice part is that this allows us to reuse these metafunctions to implement `make_tuple` and `make_pair` before C++20, but IDK whether the standard allows us to bring these names into namespace `std` with a `using` declaration?
> > > 
> > > Is that observable (e.g. through ADL associated namespaces)?
> > After more thought: No, this is not viable.
> > 
> > I believe these are technically customization points for users, so it needs to have the same declaration as in the standard, not just the same spelling.
> > 
> > Bummer.
> > 
> > I guess the best route is to have `__foo` for use pre-C++20, and the we can implement `foo` in terms of `__foo`?
> > I believe these are technically customization points for users, so it needs to have the same declaration as in the standard, not just the same spelling.
> 
> We need to fix that.. Only things that are specifically designed to be customization points should be customizable by users. We need a way to tag things in the standard as being a customization point.
> I guess the best route is to have `__foo` for use pre-C++20, and the we can implement `foo` in terms of `__foo`?

We use this approach in lots of other places.


================
Comment at: libcxx/include/utility:631
+struct unwrap_ref_decay : unwrap_reference<typename decay<_Tp>::type> { };
+#endif // >= C++20
+
----------------
You've still got a C++20 here :-)


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54485/new/

https://reviews.llvm.org/D54485





More information about the libcxx-commits mailing list