Date: Thu, 15 Feb 2024 12:10:40 +0100
czw., 15 lut 2024 o 11:23 Jonathan Wakely via Std-Proposals
<std-proposals_at_[hidden]> napisaĆ(a):
>
>
>
> On Thu, 15 Feb 2024 at 09:54, Tiago Freire via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>
>> And what exactly would this do?
>
>
> Exactly what the standard does for subrange::size_ in [range.subrange.general]
>
>
> make-unsigned-like-t<iter_difference_t<I>> size_ = 0; // exposition only; present only
> // if StoreSize is true
>
>
>
>
>>
>> -----Original Message-----
>> Subject: [std-proposals] Requires-clause for data members
>>
>> Has there been any discussion of requires-clauses for data members?
>> Something like:
>>
>> > template<int N>
>> > struct numbers {
>> > int x requires (N >= 1) = 0; // leading
>> > int y requires (N >= 2) = 0; // trailing };
>>
>> It seems grammatically possible if you mandate parentheses, and it would certainly help people reduce the use of partial specializations in these places.
>
>
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3613.pdf#section.5 has some discussion of an earlier idea like this, based on features in the D language.
>
Then what will be the behavior of:
```
size_ = 13;
```
If we consider this as "zombi" name, we could issue a warning like:
"variable is deleted".
But it will work fine in code like:
```
void setSize(int i) require (StoreSize == true)
{
size_ = i;
}
void setSize(int) require (StoreSize == false)
{
// nothing
}
```
This will still be "viral" but at least we could easily reason about
code as `size_` always means the same thing but
in some cases is not accessible.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
<std-proposals_at_[hidden]> napisaĆ(a):
>
>
>
> On Thu, 15 Feb 2024 at 09:54, Tiago Freire via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>
>> And what exactly would this do?
>
>
> Exactly what the standard does for subrange::size_ in [range.subrange.general]
>
>
> make-unsigned-like-t<iter_difference_t<I>> size_ = 0; // exposition only; present only
> // if StoreSize is true
>
>
>
>
>>
>> -----Original Message-----
>> Subject: [std-proposals] Requires-clause for data members
>>
>> Has there been any discussion of requires-clauses for data members?
>> Something like:
>>
>> > template<int N>
>> > struct numbers {
>> > int x requires (N >= 1) = 0; // leading
>> > int y requires (N >= 2) = 0; // trailing };
>>
>> It seems grammatically possible if you mandate parentheses, and it would certainly help people reduce the use of partial specializations in these places.
>
>
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3613.pdf#section.5 has some discussion of an earlier idea like this, based on features in the D language.
>
Then what will be the behavior of:
```
size_ = 13;
```
If we consider this as "zombi" name, we could issue a warning like:
"variable is deleted".
But it will work fine in code like:
```
void setSize(int i) require (StoreSize == true)
{
size_ = i;
}
void setSize(int) require (StoreSize == false)
{
// nothing
}
```
This will still be "viral" but at least we could easily reason about
code as `size_` always means the same thing but
in some cases is not accessible.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2024-02-15 11:10:52