Bug 10088 – std.range.chunks of string too

Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-15T09:50:00Z
Last change time
2014-06-06T20:38:08Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-05-15T09:50:44Z
import std.stdio: writeln; import std.range: chunks; void main() { writeln(chunks("abcd", 2)); } Output: ...\dmd2\windows\bin\..\..\src\phobos\std\range.d(6520): Error: template instance Chunks!(string) does not match template declaration Chunks(Source) if (isInputRange!(Source) && hasSlicing!(Source) && hasLength!(Source)) test.d(4): Error: template instance std.range.chunks!(string) error instantiating Expected: ["ab", "cd"]
Comment #1 by bearophile_hugs — 2013-05-21T12:53:06Z
Apparently in my code most needs of chunks() involve ASCII (or UTF-8) strings.
Comment #2 by justin — 2014-06-06T20:38:08Z
Tested in 2.065, now works as expected.