std.range.put?

simendsjo simendsjo at gmail.com
Mon May 21 04:26:32 PDT 2012


Shouldn't the following work?

import std.range;
import std.stdio;

void main() {
     int[] a;
     a.reserve(10);
     //a.put(1); // Attempting to fetch the front of an empty array of int
     a.length = 1;
     writeln(a.length); // 1
     a.put(2);
     writeln(a.length); // 0 - what?
     writeln(a); // [] - come on!

     char[] b;
     //b.put('a'); // range.d(615): Error: static assert  "Cannot put a  
char into a char[]"
}


More information about the Digitalmars-d-learn mailing list