www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6217] New: [GSOC] result of std.algorithm.map is not movable

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6217

           Summary: [GSOC] result of std.algorithm.map is not movable
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: dmitry.olsh gmail.com



14:26:58 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 26 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6217


Dmitry Olshansky <dmitry.olsh gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



08:35:27 PDT ---
https://github.com/D-Programming-Language/phobos/pull/462

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 30 2012