C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] [External] std::to_array support for zero-length arrays
From: Zhihao Yuan (zy_at_[hidden])
Date: 2020-11-05 01:17:28


On Wednesday, November 4, 2020 3:32 PM, Arthur O'Dwyer via Std-Proposals <std-proposals_at_[hidden]> wrote:

> If you're able to follow the advice in the post (such as "avoid std::array" and "avoid manually counting array elements"), it might be very helpful.

I'm waiting for your proposal to allow empty
C arrays.

> Well, the post's advice is orthogonal to your original proposal about std::to_array<T>({}) -- but, IMO, that original problem is completely solved by saying "just use std::array<T,0>{} or std::array<T,sizeof...(args)>{args...} as appropriate, which has the benefit of speeding up your code."

Counting 0 is, by definition, also a form of
"manually counting array elements," so
does counting sizeof...(elements).

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________



STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups