[Issue 18168] New: std.base64.encode for output ranges should be usable in @safe

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 3 03:26:59 UTC 2018


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

          Issue ID: 18168
           Summary: std.base64.encode for output ranges should be usable
                    in @safe
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: greensunny12 at gmail.com

void test() @safe
{
    import std.base64;
    struct OutputRange
    {
        char[] result;
        void put(const(char) ch) @safe
        {
            result ~= ch;
        }
    }

    ubyte[] data = [0x1a, 0x2b, 0x3c, 0x4d, 0x5d, 0x6e];
    OutputRange output;
    assert(Base64.encode(data, output) == 8);
    assert(output.result == "Gis8TV1u");
}

--


More information about the Digitalmars-d-bugs mailing list