Bug 19596 – Docs on .walkLength are wrong

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-01-19T16:12:58Z
Last change time
2019-01-26T20:13:23Z
Assigned to
No Owner
Creator
Victor Porton

Comments

Comment #0 by porton — 2019-01-19T16:12:58Z
https://dlang.org/phobos/std_range_primitives.html#walkLength "This is a best-effort implementation of length for any kind of range." This statement from the docs is not true. walkLength (and probably some other functions) do not work for a range with @disable'd copy constructor. So it is not "for any kind of range" as claimed in the docs. Correct either the code to conform the docs or the docs.
Comment #1 by dhasenan — 2019-01-26T20:13:23Z
You cannot pass a non-copyable struct to a function by value. There is little point in advertising this fact in the docs for every function that can possibly accept a user-defined struct. It's something you have to know when you use this feature. Pass a pointer to the range instead.