Alternatives to pointers?
Elronnd
elronnd at em.slashem.me
Fri Sep 29 04:27:55 UTC 2017
On Friday, 29 September 2017 at 03:37:53 UTC, Jonathan M Davis
wrote:
> You could always create a wrapper struct for the pointer and
> then not overload opIndex.
...alternatively, you could create a wrapper struct for the
pointer, do 'alias this' on said pointer, and then overload
opIndex to call static assert(0);. Like this:
struct Ptr(T) {
private T *_ptr;
alias _ptr this;
this(T *val) {
_ptr = val;
}
void opIndex(size_t index)() {
static assert(0);
}
}
More information about the Digitalmars-d
mailing list