error message?
rm
roel.mathys at gmail.com
Sat Oct 28 00:32:52 PDT 2006
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
More information about the Digitalmars-d
mailing list