C++ Logo

std-proposals

Advanced search

Re: Are constrained type barred from std:: implementations?

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Fri, 20 Aug 2021 15:37:14 -0400
On Fri, Aug 20, 2021 at 1:52 PM DBJ via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Many thanks to all on replies. Let me try and clarify.
>
> I was specifically told by one of the STL authors, the standard allows for illegal types to be defined from std:: templates.
>
> Examples given were:
>
> using bad_type_1 = tuple<void>; using bad_type_2 = basic_string_view<void ***>;
>
> I also understood the standard is barring STL authors to constrain the types and use (for example) enable_if<> for C++ < 20 or requires for C++ >= 20 , thus they are using static_assert().

No, they're using `static_assert` here because they want to. They
could use any tool so long as it has the appropriate effect, depending
on the constraint requirements of the standard.

Received on 2021-08-20 14:37:29