digitalmars.D - error message?
- rm (26/26) Oct 28 2006 First of all, this code:
First of all, this code:
import std.stdio;
template check( char ch1, char ch2)
{
const bool check = ch1 == ch2;
}
void main()
{
const char[] s = "123+456" ;
writefln( check!( '+', s[3] ));
}
gives the following message: "s is used as a type"
Can somebody explain to me what's wrong with the code?
But if I add two characters (check the differences :-) ):
import std.stdio;
template check( char ch1, char ch2)
{
const bool check = ch1 == ch2;
}
void main()
{
const char[] s = "123+456" ;
writefln( check!( '+', (s)[3] )); // added parentheses
}
it compiles fine?
roel
Oct 28 2006








rm <roel.mathys gmail.com>