[libcxx-commits] [PATCH] D108216: [libc++] Formulate _EnableIf in terms of std::enable_if

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 1 12:26:14 PDT 2021


Quuxplusone requested changes to this revision.
Quuxplusone added a comment.

@ldionne wrote:

> I think I can argue that with the current evidence, this patch should land, so I'm going to do that unless someone has additional concerns. I'm leaving this patch open for 24hrs to get comments from folks (ping @EricWF in particular), then I'm landing this.

For the record, I'm **still opposed** to the massive amount of code churn here. Suppose I could get a change into Clang trunk that would "look through" arbitrary AliasTemplates before deciding whether something counted as `enable_if_t`, so that we would get a good diagnostic from

  template<bool B, class T = void> using _EnableIf = typename enable_if<B, T>::type;

...then would you consider leaving all the `_EnableIf` usages alone? You could still rip out the `_MetaBase<B>::_EnableIfImpl<T>` backend; I do share your skepticism about the performance impact (and wish @EricWF would weigh in; shouldn't we give more than 72h to reply after pinging him for the first time on this PR?).  As I said before:

> (3) If all else fails, could we keep using the spelling _EnableIf, and just define _EnableIf as an alias for enable_if_t? At least then it would be easy for anyone who cared about compile-time performance to just patch it in one place. (Arguably I bet it would do no harm for them to patch it at the enable_if_t level, and thus speed up even more things than just libc++ itself.) Also, it would make this patch a lot less invasive.

Not only would this preserve the "bottleneck," it would also preserve a (useful, question mark?) distinction between "things that are mandated to use literally `enable_if`" and "things where we just need to do some SFINAE, via whatever unspecified mechanism is considered best this year."  Suppose someone in 2025 wanted to replace all the latter SFINAE with `requires`; will they be able to do it by a search-and-replace on `_EnableIf` or will they have to carefully audit every use of `enable_if_t` to see whether it's mandated or not?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108216



More information about the libcxx-commits mailing list