UPtr.opUnary

Provides dereferencing for pointers that are not class

struct UPtr(T, Allocator = Mallocator)
static if(!is(T == class))
opUnary
(
string s
)
()
if (
s == "*"
)

Examples

class A {}
auto unique = newUnique!int(42);
assert(*unique == 42);
immutable auto classPtr = newUnique!A();
assert(!__traits(compiles, *classPtr));

Meta