Subject: Re: [std-proposals] std::to_array support for zero-length arrays
From: Zhihao Yuan (zy_at_[hidden])
Date: 2020-11-03 22:38:12
On Tuesday, November 3, 2020 10:01 PM, D'Alessandro, Luke K via Std-Proposals <std-proposals_at_[hidden]> wrote:
>> template <typename T>
>> constexpr array<T, 0> to_array(std::array<T, 0>);
> I see no particular constraints on T in [array.zero], nor do any of the constructor traits appear to be relevant here, thus I have no preconditions and merely carried forward the is_array_v mandate from the existing overloads.
Since you get rationale and examples,
that fits in a small paper.
I slightly prefer a tag solution, because
array<T, 0> is not physically zero (or 1) size.
Accepting one as an argument may have
some cost. Another issue is that the type
array<T, 0> is public. You don't mean to
allow people to do
std::array<int, 0> a;
-- Zhihao Yuan, ID lichray The best way to predict the future is to invent it. _______________________________________________
STD-PROPOSALS list run by email@example.com
Standard Proposals Archives on Google Groups