use of typeof to determine auto type with ndslice examples

Jay Norwood via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Dec 20 20:20:16 PST 2015


I pulled down the std.experimental.ndslice examples and am 
attempting to build some of the examples and understand the types 
being used.

I know don't need all these imports, but it is hard to guess 
which ones are needed, and the examples often don't provide them, 
which I suspect is a common gripe here.

Anyway, I was expecting to be able to use the typeof pragma to 
print a type that could use as a fully specified type, and that 
doesn't seem to be the case.  I get a compile error instead.

DMD32 D Compiler v2.069.2 on win32, "dip80-ndslice": "~>0.8.4"

Is there some other way to get a valid fully specified type for 
these sliced auto variables?

import std.stdio;
import std.experimental.ndslice;

void main() {
     import std.algorithm.iteration: map;
     import std.array: array;
     import std.range;
     import std.traits;
     auto t0 = 1000.iota.sliced(3, 4, 5);

     pragma(msg, typeof(t0));
     Slice!(3u, Result) = 1000.iota.sliced(3, 4, 5);

Slice!(3u, Result)
src\app.d(12,2): Error: undefined identifier 'Result'
dmd failed with exit code 1.


More information about the Digitalmars-d-learn mailing list