← Back to index
|
Original Bugzilla link
Bug 13857 – std.algorithm.group doesn't work with range of immutables
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-12-11T23:20:00Z
Last change time
2014-12-14T16:35:43Z
Assigned to
nobody
Creator
hsteoh
Comments
Comment #0
by hsteoh — 2014-12-11T23:20:56Z
Code: ------ import std.algorithm; void main() { immutable(int)[] data = [1,1,2,2,2,3,4,4,5,6,6,7,8,9,9,9]; auto g = group(data); } ------ Compiler output: ------ /usr/src/d/phobos/std/algorithm.d(4475): Error: cannot modify struct this._current Tuple!(immutable(int), uint) with immutable members test.d(4): Error: template instance std.algorithm.group!("a == b", immutable(int)[]) error instantiating /usr/src/d/phobos/std/algorithm.d(4507): Error: cannot modify struct ret._current Tuple!(immutable(int), uint) with immutable members /usr/src/d/phobos/std/algorithm.d(4514): Error: template instance std.algorithm.Group!("a == b", immutable(int)[]) error instantiating test.d(4): instantiated from here: group!("a == b", immutable(int)[]) ------ Since the range itself isn't immutable, this code should work.
Comment #1
by peter.alexander.au — 2014-12-14T16:35:43Z
*** This issue has been marked as a duplicate of issue 10104 ***