How to make a transparent wrapper type?

Namespace via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 7 12:03:07 PST 2015


This seems to work:
----
struct RefVal(T) {
	private T* ptr;
	
     this(T* val) {
		ptr = val;
	}
	
     ref auto opAssign(U)(auto ref U value) {
		*ptr = value;
		
		return *ptr;
	}
	
	auto get() inout {
		return ptr;
	}
}
----


More information about the Digitalmars-d-learn mailing list