C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: Unnecessary clause in std::variant
From: Nevin Liber (nevin_at_[hidden])
Date: 2019-11-26 19:00:12


On Tue, Nov 26, 2019 at 6:49 PM Myria via Std-Discussion <
std-discussion_at_[hidden]> wrote:

> In the Standard's description of std::variant, there is this line:
>
> "A program that instantiates the definition of variant with no template
> arguments is ill-formed."
> https://eel.is/c++draft/variant#variant-3
>
> A bit later, regarding the variant(T&&) constructor, there is this:
> "Remarks: This function shall not participate in overload resolution unless
> - sizeof...(Types) is nonzero,"
> https://eel.is/c++draft/variant#ctor-16
>
> Is this a redundant statement? "Types" is std::variant's parameter pack,
> so sizeof...(Types) == 0 would've already been ill-formed, not simply a
> failed overload.
>
> Looks like an editorial issue to file, but I wanted to ask people here
> first.
>

Looks editorial to me, probably an artifact of when a variant of no
template arguments was allowed (IIRC, a National Body comment during the
C++17 ballot removed that feature).

-- 
 Nevin ":-)" Liber  <mailto:nevin_at_[hidden] <nevin_at_[hidden]>>
+1-847-691-1404


STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups