template class properties
mstrlu
skateBBH at yahoo.com
Thu Dec 27 15:52:38 PST 2007
I got another qestion regarding fucntion templates:
Why isn't it possible to use the "property syntax" with function templates?
import std.stdio;
void test(int x = 0)( int y ){
writefln( "tmpl:", x, " val:", y);
}
int test2(int x = 0)(){
return 15;
}
int main(){
writefln( test2() ); //works
writefln( test2 ); // doesn't work: "Error: template test2(int x = 0) has no value"
test!(2)(3); //works
test(3); //works
test = 3; //doesn't work: "Error: test is not an lvalue"
//and "Error: cannot implicitly convert expression (3) of type int to void
return 0;
}
I would also be interested to know why the "property syntax" is not documented as an alternative to write function calls of functions with special signatures ( cause for me it looks like that ), but instead in as "class properties" ( although it works also with not-member functions ).
thank you
More information about the Digitalmars-d-learn
mailing list