[libcxx-commits] [PATCH] D96523: [libc++] Rewrite the tuple constructors to be strictly Standards conforming

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 30 12:47:32 PDT 2021


ldionne added a comment.

In D96523#2729663 <https://reviews.llvm.org/D96523#2729663>, @EricWF wrote:

> I'm working to see if I can fix forward the template depth and constexpr
> issues, but I would appreciate some help from @ldionne as the original
> author.

I'm working on the constexpr issue right now. I only just saw this.

> In general this removes a bunch of carefully constructed SFINAE meant to improve compile times.

The SFINAE in this patch is also meant to instantiate as few templates as possible when it can. After looking into it, I think the problem is that our implementation of `_And` is a bit naive, it shouldn't recurse as much. I'm pretty sure that'll solve the problem.



================
Comment at: libcxx/include/tuple:878
+    template <class _Up1, class _Up2, class ..._DependentTp>
+    struct _EnableImplicitMoveFromPair : _And<
+        is_constructible<_FirstType<_DependentTp...>, _Up1>,
----------------
EricWF wrote:
> Why can't we use alias templates rather than instantiating a big type here?
Cause we're hiding the instantiation of the `_And` behind the struct instantiation, such that when e.g. `_BoolConstant<sizeof...(_Tp) == 2>` is false below, we don't instantiate anything. Mentioning a template specialization is cheap when you don't actually instantiate it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96523



More information about the libcxx-commits mailing list