Date: Mon, 10 Feb 2025 17:02:53 +0100
You're absolutely right! doing nothing is considerably easier than doing
something :P
But afaik that's not the criteria to consider or reject proposals, maybe
I'm wrong. Apart from the correct and true fact "*If you include a header
and write the loop 'like this' you can do the same*" is there any other
reason to end the discussion?
Missatge de Jonathan Wakely <cxx_at_[hidden]> del dia dl., 10 de febr. 2025
a les 16:49:
>
>
> On Mon, 10 Feb 2025 at 15:13, Pau Miquel Montequi Hernandez <
> pau.montequi_at_[hidden]> wrote:
>
>> @Marcin Jaczewski
>>
>> Allow code like:
>>>
>>> for (int i : std::views::iota(1, 10))
>>> std::cout << i << ' ';
>>>
>>> Other versions you can create helpers in a similar way.
>>
>>
>> This example requires to include a header instead of being an intrinsic
>> property of the for loop. Also is way more verbose than for (int i = 1 :
>> 10) my hope is to make things simpler and easier to read without losing
>> functionality.
>>
>> @Jonathan Wakely
>>
>> You can do this today with a structured binding:
>>
>> for (auto [b,e,o] = std::tuple(in, in + size, out); b != e; ++b, ++o)
>>> *o = std::tolower(*b);
>>
>>
>> True, but isn't creating a tuple to just decompose it
>> excessively verbose? Not to mention the need to include a header;
>>
>
> That's considerably easier than changing the language, and works today :-)
>
>
>
>> also we lose the expressivity of separating each declaration, on my
>> opinion each part separated on different declarations implies
>> intentionality, also more control on the resulting type, i.e:
>>
>> template <auto size>
>>> void lcase(const char (&in)[size], char (&out)[size])
>>> {
>>> for (const char *b = in; const char *const e = in + size; char *o =
>>> out; b != e; ++b, ++o) // Three different explicit types
>>> *o = std::tolower(*b);
>>> }
>>
>>
>>
>> Missatge de Jonathan Wakely <cxx_at_[hidden]> del dia dl., 10 de febr.
>> 2025 a les 15:31:
>>
>>>
>>>
>>> On Mon, 10 Feb 2025 at 14:18, Pau Miquel Montequi Hernandez via
>>> Std-Proposals <std-proposals_at_[hidden]> wrote:
>>>
>>>>
>>>> More flexible for loop initialization, allowing multiple init
>>>> statements:
>>>>
>>>>> template <auto size>
>>>>> void lcase(const char (&in)[size], char (&out)[size])
>>>>> {
>>>>> for (auto b = in, e = in + size; auto o = out; b != e; ++b, ++o)
>>>>>
>>>>
>>> You can do this today with a structured binding:
>>>
>>> for (auto [b,e,o] = std::tuple(in, in + size, out); b != e; ++b, ++o)
>>>
>>>
>>>> *o = std::tolower(*b);
>>>>> }
>>>>
>>>>
>>>>
>>
>> --
>> Pablo Miguel Montequi Hernández.
>>
>
something :P
But afaik that's not the criteria to consider or reject proposals, maybe
I'm wrong. Apart from the correct and true fact "*If you include a header
and write the loop 'like this' you can do the same*" is there any other
reason to end the discussion?
Missatge de Jonathan Wakely <cxx_at_[hidden]> del dia dl., 10 de febr. 2025
a les 16:49:
>
>
> On Mon, 10 Feb 2025 at 15:13, Pau Miquel Montequi Hernandez <
> pau.montequi_at_[hidden]> wrote:
>
>> @Marcin Jaczewski
>>
>> Allow code like:
>>>
>>> for (int i : std::views::iota(1, 10))
>>> std::cout << i << ' ';
>>>
>>> Other versions you can create helpers in a similar way.
>>
>>
>> This example requires to include a header instead of being an intrinsic
>> property of the for loop. Also is way more verbose than for (int i = 1 :
>> 10) my hope is to make things simpler and easier to read without losing
>> functionality.
>>
>> @Jonathan Wakely
>>
>> You can do this today with a structured binding:
>>
>> for (auto [b,e,o] = std::tuple(in, in + size, out); b != e; ++b, ++o)
>>> *o = std::tolower(*b);
>>
>>
>> True, but isn't creating a tuple to just decompose it
>> excessively verbose? Not to mention the need to include a header;
>>
>
> That's considerably easier than changing the language, and works today :-)
>
>
>
>> also we lose the expressivity of separating each declaration, on my
>> opinion each part separated on different declarations implies
>> intentionality, also more control on the resulting type, i.e:
>>
>> template <auto size>
>>> void lcase(const char (&in)[size], char (&out)[size])
>>> {
>>> for (const char *b = in; const char *const e = in + size; char *o =
>>> out; b != e; ++b, ++o) // Three different explicit types
>>> *o = std::tolower(*b);
>>> }
>>
>>
>>
>> Missatge de Jonathan Wakely <cxx_at_[hidden]> del dia dl., 10 de febr.
>> 2025 a les 15:31:
>>
>>>
>>>
>>> On Mon, 10 Feb 2025 at 14:18, Pau Miquel Montequi Hernandez via
>>> Std-Proposals <std-proposals_at_[hidden]> wrote:
>>>
>>>>
>>>> More flexible for loop initialization, allowing multiple init
>>>> statements:
>>>>
>>>>> template <auto size>
>>>>> void lcase(const char (&in)[size], char (&out)[size])
>>>>> {
>>>>> for (auto b = in, e = in + size; auto o = out; b != e; ++b, ++o)
>>>>>
>>>>
>>> You can do this today with a structured binding:
>>>
>>> for (auto [b,e,o] = std::tuple(in, in + size, out); b != e; ++b, ++o)
>>>
>>>
>>>> *o = std::tolower(*b);
>>>>> }
>>>>
>>>>
>>>>
>>
>> --
>> Pablo Miguel Montequi Hernández.
>>
>
-- Pablo Miguel Montequi Hernández.
Received on 2025-02-10 16:03:16