D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 13857 - std.algorithm.group doesn't work with range of immutables
Summary: std.algorithm.group doesn't work with range of immutables
Status: RESOLVED DUPLICATE of issue 10104
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-11 23:20 UTC by hsteoh
Modified: 2014-12-14 16:35 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description hsteoh 2014-12-11 23:20:56 UTC
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 Peter Alexander 2014-12-14 16:35:43 UTC

*** This issue has been marked as a duplicate of issue 10104 ***