Simple way to dereference common symbol

Adam D. Ruppe destructionator at gmail.com
Sat Oct 5 00:45:44 UTC 2019


On Saturday, 5 October 2019 at 00:39:03 UTC, Brett wrote:
> is there a way to use a abstract this easily?

I'd just use a traditional function for it, a little three liner.

----
struct Foo {
	int longName;
}

// note ufcs only works when declared top level so it cant be 
nested in main.... but you could nest it if you called it C(foo), 
of course
auto C(ref Foo a) {
	return a.longName;
}
void main() {

	Foo foo;

	foo.C;
}
----


More information about the Digitalmars-d-learn mailing list