Challenge level - Moderately easy

Consider the function std.string.wrap:

  http://dlang.org/phobos/std_string.html#.wrap

It takes a string as input, and returns a GC allocated string that is word-wrapped. It needs to be enhanced to:

1. Accept a ForwardRange as input.
2. Return a lazy ForwardRange that delivers the characters of the wrapped result one by one on demand.
3. Not allocate any memory.
4. The element encoding type of the returned range must be the same as the element encoding type of the input.

Reply via email to