@trusted delegates all over std.array

TheFlyingFiddle kurtyan at student.chalmers.se
Sun Feb 2 09:40:46 PST 2014


Why is std.array litered with @trusted delegates?

Ex:

in the clear method in Appender.

void clear() @safe pure nothrow
{
    if(_data)
    {
       _data.arr = ()@trusted { return _data.arr.ptr[0 .. 0]; }();
    }
}

Is it to enable @safe? And should it be allowed i mean the code 
does deal with pointers so it really should be made @trusted? Or 
is the reasoning that as much of the standard library should be 
@safe as possible so some small hacks are ok?


More information about the Digitalmars-d-learn mailing list