protocol for using InputRanges
Steven Schveighoffer
schveiguy at yahoo.com
Thu Mar 27 13:59:33 PDT 2014
On Thu, 27 Mar 2014 16:53:35 -0400, Walter Bright
<newshound2 at digitalmars.com> wrote:
> On 3/27/2014 9:12 AM, monarch_dodra wrote:
>> If you initialized the next element in both constructor
>
> As mentioned earlier, requiring this of a range constructor makes it
> impossible to separate composition of a range with using it.
Not impossible. Use lazy initialization.
> As also mentioned earlier, this throws under the bus entire categories
> of use cases for ranges, all to avoid a single call to 'empty'.
This is going to look weird:
r.empty;
// now we can use it...
It only makes sense if you are using empty in your processing of the range.
-Steve
More information about the Digitalmars-d
mailing list