const-correctness in std.range

2014-08-31 Thread Vlad Levenfeld via Digitalmars-d-learn
I notice that some of the range adapters in std.range (iota, takeExactly) have a const empty property, while others (take, retro) don't. This makes maintaining const-correctness downstream (with my own range adapters atop phobos') more difficult. I'm wondering if there is a rationale for this,

Re: const-correctness in std.range

2014-08-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, 1 September 2014 at 03:45:25 UTC, Vlad Levenfeld wrote: I notice that some of the range adapters in std.range (iota, takeExactly) have a const empty property, while others (take, retro) don't. This makes maintaining const-correctness downstream (with my own range adapters atop phobos

Re: const-correctness in std.range

2014-09-02 Thread Vlad Levenfeld via Digitalmars-d-learn
Thanks for the reply. And indeed, I recently found that ByLine.empty can't be const because it writes and removes a character from the stream or something... and when I compile with optimizations, const empty gets totally wrecked. I suppose that making empty const doesn't really gain me any