digitalmars.D.learn - std.uni.CodepointSet from range of pairs of integers
- Carl Sturtivant (16/16) Feb 18 I wanted to construct a CodepointSet from a string, so I used the
- Richard (Rikki) Andrew Cattermole (5/5) Feb 18 I can understand ``pure``.
- Carl Sturtivant (5/11) Feb 18 What about needing a forward range, not just an input range? It
- Richard (Rikki) Andrew Cattermole (5/18) Feb 18 Indeed, nothing in that function body would suggest it needs to be a
- Carl Sturtivant (3/11) Feb 19 Thank you for looking into this.
- Carl Sturtivant (3/6) Feb 19 I should have noticed this!
I wanted to construct a CodepointSet from a string, so I used the constructor here. https://dlang.org/phobos/std_uni.html#.InversionList.this.2 I wrote a range of pairs (CodepointIntervals) of integers consisting of each codepoint in the string paired with that plus one. This did solve the problem, but only after I overcame some peculiarities of the situation. Specifically, this required a forward range, not just an input range, so I wrote a save method. Once I fixed that problem, it needed empty() and popFront() to be pure. So I added the word pure to each in my range. Once I fixed that problem, it required those to be safe, so I added that to my struct declaration of my range. Then everything worked. Could I have anticipated any of this, and what is the reason for each of these?
Feb 18
I can understand ``pure``. https://github.com/dlang/phobos/blob/master/std/uni/package.d#L2075 It is literally on the constructor. Now safe I don't know. My best guess would be for some reason the constructor is getting inferred as it (templates get inferred).
Feb 18
On Monday, 19 February 2024 at 01:42:03 UTC, Richard (Rikki) Andrew Cattermole wrote:I can understand ``pure``. https://github.com/dlang/phobos/blob/master/std/uni/package.d#L2075 It is literally on the constructor. Now safe I don't know. My best guess would be for some reason the constructor is getting inferred as it (templates get inferred).What about needing a forward range, not just an input range? It would seem it just needs to iterate through a sequence of pairs of integers.
Feb 18
On 19/02/2024 5:33 PM, Carl Sturtivant wrote:On Monday, 19 February 2024 at 01:42:03 UTC, Richard (Rikki) Andrew Cattermole wrote:Indeed, nothing in that function body would suggest it needs to be a forward range. Ah yup, the body was changed but never updated its template conditional. https://github.com/dlang/phobos/commit/c9f1c42ed3a8bb92e48bf400ce2f31f434a99905I can understand ``pure``. https://github.com/dlang/phobos/blob/master/std/uni/package.d#L2075 It is literally on the constructor. Now safe I don't know. My best guess would be for some reason the constructor is getting inferred as it (templates get inferred).What about needing a forward range, not just an input range? It would seem it just needs to iterate through a sequence of pairs of integers.
Feb 18
On Monday, 19 February 2024 at 04:47:07 UTC, Richard (Rikki) Andrew Cattermole wrote:On 19/02/2024 5:33 PM, Carl Sturtivant wrote:Thank you for looking into this.On Monday, 19 February 2024 at 01:42:03 UTC, Richard (Rikki) Andrew Cattermole wrote:Indeed, nothing in that function body would suggest it needs to be a forward range. Ah yup, the body was changed but never updated its template conditional. https://github.com/dlang/phobos/commit/c9f1c42ed3a8bb92e48bf400ce2f31f434a99905
Feb 19
On Monday, 19 February 2024 at 01:42:03 UTC, Richard (Rikki) Andrew Cattermole wrote:I can understand ``pure``. https://github.com/dlang/phobos/blob/master/std/uni/package.d#L2075 It is literally on the constructor.I should have noticed this!
Feb 19