www.digitalmars.com         C & C++   DMDScript  

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


          Issue ID: 18036
           Summary: Documentation of moveFront() fails to mention
                    different behavior depending on
           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);
        static assert(0,
                "Cannot move front of a range with a postblit and an rvalue

but the documentation ignores that fact.


Dec 05 2017