Thread overview
[Issue 8772] New: DList.remove doesn't work with result of std.range.take
Oct 07, 2012
Jonathan M Davis
October 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8772

           Summary: DList.remove doesn't work with result of
                    std.range.take
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: callumenator@gmail.com


--- Comment #0 from callumenator@gmail.com 2012-10-06 20:28:16 PDT ---
DMD v2.060

import std.range, std.algorithm, std.container;

void main()
{
    auto list = DList!int([1,2,3,4,5]);
    list.remove(list[].find(3).take(1));
}

Error: function std.container.DList!(int).DList.remove (Range r) is not
callable using argument types (Take!(Range))

However, DList.linearRemove does work with take.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8772



--- Comment #1 from callumenator@gmail.com 2012-10-06 22:22:11 PDT ---
The same also is true for the insert functions.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8772


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg@gmx.com


--- Comment #2 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-10-06 22:38:46 PDT ---
Actually, _all_ of the take* functions should work - take, takeExactly, takeOne, takeNone - but I think that take is pretty much the only one that works right now, and not all of the functions which should accept it do (hence the bug report).

Andrei recently expressed the desire to standardize on wrapper ranges providing access to what the range that they're wrapping when appropriate (though it's not always appropriate) via a member variable called source (which Take has), which may or may not make implementing the changes to std.container simpler and may or may not make it possible for the std.container functions to operate on more range types than those returned by take*. But the take* family should definitely all work or std.container is crippled with regards to any of its member functions which takes a range from the container.

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