[libcxx-commits] [PATCH] D116388: [libc++] Properly handle specializations of std::is_placeholder.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 3 14:45:32 PST 2022


ldionne added a comment.

In D116388#3214312 <https://reviews.llvm.org/D116388#3214312>, @Quuxplusone wrote:

> ...and I forgot to answer @ldionne's question about conformingness, so I'll do it here!
>
> My understanding is that `std::bind` is just massively underspecified. For example, https://eel.is/c++draft/func.bind.isbind says

Alright, in that case the LWG issue for fixing this would basically need to be a paper that rewrites a bunch of it. Nevermind on that.

>> The function template `bind` uses `is_­bind_­expression` to detect subexpressions. [...] A program may specialize this template for a program-defined type `T` to have a base characteristic of `true_­type` to indicate that `T` should be treated as a subexpression in a `bind` call.
>
> But, like, //how// does it use `is_­bind_­expression` to detect subexpressions? and what does it mean to "be treated as a subexpression"? and what happens if this template is specialized to have a base characteristic of something-other-than-`true_type`? None of this is written out. But I think clearly the //intent// is what's happening in this PR: a single specialization for `T` should magically apply to all cv-qualifications and value-categories of `T`.
>
> [...]

Thanks a lot for the detailed explanation. Another question on the approach, then. Why don't we do this instead?

  template<class _Tp> struct __is_placeholder : integral_constant<int, 0> { };
  template<class _Tp> struct __is_placeholder<_Tp const> : is_placeholder<_Tp> { };
  template<class _Tp> struct __is_placeholder<_Tp volatile> : is_placeholder<_Tp> { };
  
  template<class _Tp> 
  struct is_placeholder
    : __is_placeholder<__uncvref_t<_Tp>>
  { };


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

https://reviews.llvm.org/D116388



More information about the libcxx-commits mailing list