D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6217 - [GSOC] result of std.algorithm.map is not movable
Summary: [GSOC] result of std.algorithm.map is not movable
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-26 14:26 UTC by Dmitry Olshansky
Modified: 2012-03-30 08:35 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Dmitry Olshansky 2011-06-26 14:26:58 UTC
import std.algorithm;

void main()
{
	auto m = map!"a"([1,2,3]);
	auto x = move(m);
}

bails out with:

C:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1400): Error: function std.
algorithm.map!("a").map!(int[]).map is a nested function and cannot be accessed
from move

It also hits the following code:

import std.range, std.algorithm;

void main()
{
	int[] arr = [ 1, 2, 3, 4];
	auto s = assumeSorted(map!"a"(arr));
	assert(equal(s.lowerBound(3),[1, 2]));
}

The problem is that move is called inside release() in SortedRange template.

In my project I use sorted array of intervals [a,b] for codepoint sets, so for now I just ripped off that release() function in SortedRange.
Still some cleaner soultion for this general problem of map is needed.
Comment 1 Dmitry Olshansky 2012-03-30 08:35:27 UTC
https://github.com/D-Programming-Language/phobos/pull/462