Hi,
I am trying to create a struct with a settable method that has access to the struct scope.
Is this the only way?
Is there a way to give access without explicitly passing this
?
import std.stdio;
struct TestStruct{
float /*------------------*/ a;
float /*------------------*/ b;
float function( TestStruct ) op;
float run(){
return op( this );
}
}
void main(){
TestStruct ts = TestStruct(
2,
3,
function( TestStruct s ){ return s.a + s.b; }
);
writeln( ts.run() );
}