RFC on SlidingSplitter Range

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 3 12:46:09 PDT 2014


On Friday, 3 October 2014 at 19:31:30 UTC, monarch_dodra wrote:
> The idea is to try to keep as much code in common as possible. 
> You can keep your version, provided you write this for popFront:
>
>     void popFront()
>     {
>         if (_index < _data.length)
>         {
>             static if (isNarrowString!R)
>                 _index += stride(_data, _index)
>             else
>                 ++_index;
>         }
>     }

Superb!

Is prefix ++ preferred in D because of some specific reason? I 
recall it, for some containers/iterators, gives smaller/faster 
codegen in C++?

> You could perfectly well support infinite ranges, with the 
> correct static ifs. You'd produce an infinite sliding splitter.

That's for episode 3 ;)


More information about the Digitalmars-d-learn mailing list