digitalmars.D.learn - template class properties
- mstrlu (21/21) Dec 27 2007 I got another qestion regarding fucntion templates:
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
Dec 27 2007








mstrlu <skateBBH yahoo.com>