struct aliases

Kenny B funisher at gmail.com
Wed Nov 14 12:14:37 PST 2007


Ok, I have reduced my code to a simple example... This is what I have:

class MyClass {
	struct Data {
		int val1;
		int val2;
	}
	
	Data data;
	void one_function() {
		// stuff
	}
}

MyClass c = new MyClass;
// I want to say this:
c.val1 = 5;

// not this:
c.data.val1 = 5;

---------------

I tried to alias the data.val1 val1 -- but it doesn't work. I know this
works though...

int val1;
alias val1 val2;

val2 = 5;
assert(val1 == val2);

How can I do that with the structs?

I'm using gdc 0.24 on x86_64

Thanks in advance,
Kenny


More information about the Digitalmars-d-learn mailing list