Declaring constant references in struct members

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 15 16:44:18 PST 2017


On Thu, Feb 16, 2017 at 12:43:30AM +0000, David Zhang via Digitalmars-d-learn wrote:
> Hi,
> 
> Say I have a struct S that holds a reference to an object O. Is there
> a way to express that I want to be able to change the reference, but
> not what the reference points to? Thanks.
> 
> struct S {
>     O object;
> }
> 
> class O {
>     size_t things.
> }

Maybe have a look at std.typecons.Rebindable?


T

-- 
What do you call optometrist jokes? Vitreous humor.


More information about the Digitalmars-d-learn mailing list