New With Struct and Getting Class Object Pointers

Nicholas Wilson iamthewilsonator at hotmail.com
Sun Sep 30 11:11:09 UTC 2018


On Sunday, 30 September 2018 at 09:30:38 UTC, Vijay Nayar wrote:
> Is there a way to either have a constant reference to a class 
> that can be set to a new value, or is there a way to convert 
> the class variable to a class pointer?

Alex has mentioned Rebindable, which is the answer to your first 
question.
To answer your second question, no

class A {}

A a:

`a` is always a (possibly null) reference to a class instance. 
You can have pointers to class references (which is what `&a` 
gives you) but that has two indirections between the variable and 
the data, which if you want high perf is probably not what you 
are looking for.


More information about the Digitalmars-d-learn mailing list