Date: Wed, 04 Nov 2020 04:38:12 +0000
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;
foo(to_array(a));
>> 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;
foo(to_array(a));
-- Zhihao Yuan, ID lichray The best way to predict the future is to invent it. _______________________________________________
Received on 2020-11-03 22:38:27