write once type?
Steven Schveighoffer
schveiguy at gmail.com
Fri Apr 30 01:30:54 UTC 2021
On 4/29/21 5:31 PM, sighoya wrote:
> On Tuesday, 20 April 2021 at 19:56:33 UTC, Steven Schveighoffer wrote:
>> Not only that, but I may also want to keep processing the loop and do
>> something different if the value has already been set instead of
>> returning immediately, which necessitates a second loop.
>
> Can I ask why you require to handle it in one loop?
> As I see it, you are required to poll over isSet/isNotSet in every
> iteration.
>
In my case, for value of a certain type in the loop, I was storing a
specific field from the first one I found, and then verifying that all
the other values of that type (not exactly the same type, but similar)
had the same value for that field, otherwise it was an error.
I could have done it in 2 loops, but it's wasteful.
-Steve
More information about the Digitalmars-d-learn
mailing list