Templates and Associative Arrays - disregard the above post; this one has working code.

downs default_357-line at yahoo.de
Mon Jan 21 09:47:56 PST 2008


Agh. Too many mistakes. Sorry.
Here's some working, tested code instead.

> import std.stdio, std.traits;
> 
> template Init(T) { T Init; }
> 
> template NAET(T) {
>   alias ReturnType!({ foreach (elem; Init!(T)) foreach (elem2; elem) return elem2; }) NAET;
> }
> 
> void main() {
>   writefln(NAET!(int[][]).stringof);
>   writefln(NAET!(int[][int]).stringof);
>   writefln(NAET!(float[string][]).stringof);
> }

Hope it helps.

 --downs



More information about the Digitalmars-d mailing list