Reset class member variables
Sean Kelly
sean at f4.ca
Fri Sep 7 12:21:08 PDT 2007
mandel wrote:
> Ok, I jumped to early. :/
> This method ignores const values that I have set in the ctor:
> So, "this() { y = 123; }" would be reset to 0.
Hrm... to deal with that I think you'd have to use foreach and tupleof,
but I don't think D 1.0 provides a means for detecting the storage type
of a declaration. Ideally, you'd want to do something like this:
foreach( pos, inout val; this.tupleof )
{
static if( !is( typeof( val ) : const ) )
val = this.classinfo.init.tupleof[pos];
}
More information about the Digitalmars-d
mailing list