www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18036] New: Documentation of moveFront() fails to mention

https://issues.dlang.org/show_bug.cgi?id=18036

          Issue ID: 18036
           Summary: Documentation of moveFront() fails to mention
                    different behavior depending on
                    hasElaborateCopyConstructor
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dlang.org
          Assignee: nobody puremagic.com
          Reporter: acehreli yahoo.com

The source code uses hasElaborateCopyConstructor:

ElementType!R moveFront(R)(R r)
{
    static if (is(typeof(&r.moveFront)))
    {
        return r.moveFront();
    }
    else static if (!hasElaborateCopyConstructor!(ElementType!R))
    {
        return r.front;
    }
    else static if (is(typeof(&(r.front())) == ElementType!R*))
    {
        import std.algorithm.mutation : move;
        return move(r.front);
    }
    else
    {
        static assert(0,
                "Cannot move front of a range with a postblit and an rvalue
front.");
    }
}

but the documentation ignores that fact.

Ali

--
Dec 05 2017