Date: Mon, 21 Sep 2020 18:17:46 -0400
On Mon, Sep 21, 2020 at 5:47 PM Garrett May via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> Would this work?
>
> https://godbolt.org/z/WxoG4j
>
> std::extent_v should work so long as the array has not been implicitly
> converted to a pointer. However, I personally would recommend using a
> std::array, if possible, given that it's easy to get its size.
>
> https://godbolt.org/z/shW34f
>
FYI, you don't need std::array in order to use std::size — it also works on
plain old core-language arrays.
https://godbolt.org/z/ce7jT9
Relevant: https://quuxplusone.github.io/blog/2020/08/06/array-size/
Anyway, I agree with you that it's unclear what Ramkumar is trying to do
with this code. It's extremely rare that C++ code ever needs to use
std::extent for any purpose.
–Arthur
std-proposals_at_[hidden]> wrote:
> Would this work?
>
> https://godbolt.org/z/WxoG4j
>
> std::extent_v should work so long as the array has not been implicitly
> converted to a pointer. However, I personally would recommend using a
> std::array, if possible, given that it's easy to get its size.
>
> https://godbolt.org/z/shW34f
>
FYI, you don't need std::array in order to use std::size — it also works on
plain old core-language arrays.
https://godbolt.org/z/ce7jT9
Relevant: https://quuxplusone.github.io/blog/2020/08/06/array-size/
Anyway, I agree with you that it's unclear what Ramkumar is trying to do
with this code. It's extremely rare that C++ code ever needs to use
std::extent for any purpose.
–Arthur
Received on 2020-09-21 17:17:59