Template bug?
Artyom Shalkhakov
artyom.sh at gmail.ru
Mon Jan 29 20:32:03 PST 2007
Hello everyone.
I have a problem regarding D templates.
This code doesn't work. I would like to know how do I get it up'n'running?
struct temp_t( type ) {
void setOwner( type *newOwner ) {
owner = newOwner;
}
type *getOwner() {
return owner;
}
protected {
temp_t * head;
temp_t * next;
temp_t * prev;
type * owner;
}
}
class testClass_t {
this( int d ) {
data = d;
tst.setOwner( &this );
}
int data;
temp_t!( testClass_t ) tst;
}
void foo() {
testClass_t bar = new testClass_t( 0x1234 );
// what is the difference between '==' and 'is'?
assert( ( *bar ).getOwner == bar ); // doesn't work
}
Can anyone tell me what is wrong? Thanks in advance.
PS Excuse me for my English, as it's not my native language.
More information about the Digitalmars-d-learn
mailing list