std.base64 question

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Tue Nov 26 19:06:22 PST 2013


On Wednesday, 27 November 2013 at 02:43:56 UTC, Parke wrote:
> The compile error is:
>
> [snip]/src/phobos/std/range.d(614): Error: static assert  
> "Cannot put a immutable(char) into a char[40]"
> [snip]/src/phobos/std/base64.d(297):        instantiated from 
> here: put!(char[40], immutable(char))
> test.d(7):        instantiated from here: encode!(ubyte[], 
> char[40])
>
> Thanks!

I'm not finding a solution, this specific error is because a 
static array isn't an output range, see example below for "fix."

import std.range;
void main () {
     immutable(ubyte)  s0 = 5;
     ubyte[1] s1;
     auto slice = s1[];
     slice.put(s0);
}

But fixing this just results in not finding a match due to 
template constraints somewhere:

import std.base64;
ubyte[]  s0 = ['H','e','l','l','o'];
char[40] s1;
void main () {
     auto slice = s1[];
     Base64.encode (slice, s1);
}


base64.d(6): Error: template std.base64.Base64Impl!('+', 
'/').encode does not match any function template declaration. 
Candidates are:...


More information about the Digitalmars-d-learn mailing list