inout based on this reference?

Steven Schveighoffer schveiguy at yahoo.com
Mon Aug 30 06:08:11 PDT 2010


On Sun, 29 Aug 2010 17:36:24 -0400, Simen kjaeraas  
<simen.kjaras at gmail.com> wrote:

> Is it possible to make a function return dependent upon the constancy of  
> the this reference?
>
> i.e. this:
>
> struct foo {
>     int n;
>     inout( ref int ) getn( ) inout {
>         return n;
>     }
> }

Yes.  That is the bread-and-butter usage for inout.

Although inout is currently horribly broken.

-Steve


More information about the Digitalmars-d-learn mailing list