C++ Logo

std-proposals

Advanced search

Re: Pure value templates

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Mon, 21 Sep 2020 19:19:33 -0400
Submitted https://github.com/artagnon/FreelyCommute/pull/1.

On Mon, Sep 21, 2020 at 6:57 PM Ramkumar Ramachandra <artagnon_at_[hidden]>
wrote:

> Thanks for all the pointers. Looking at the big picture: Yes, the code is
> ugly, and I wish there were a better way to do it. Which also brings us to
> the limitations of std::array. I wish it were possible to use, but I can’t
> seem to.
>
> Anyway, here’s the complete file:
>
> https://github.com/artagnon/FreelyCommute/blob/master/rM/include/ParseTable.hpp
>
> R.
>
> Le mar. 22 sept. 2020 à 00:18, Arthur O'Dwyer via Std-Proposals <
> std-proposals_at_[hidden]> a écrit :
>
>> 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 mailing list
>>
>> Std-Proposals_at_[hidden]
>>
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>
>>

Received on 2020-09-21 18:19:47