Find struct not passed by reference

frame frame86 at live.com
Tue Aug 3 13:58:21 UTC 2021


On Tuesday, 3 August 2021 at 13:23:04 UTC, Tejas wrote:

> No. ```ref``` can only be used as a function/template. or 
> ```foreach``` parameter.

Yeah, I know. I was in hope of a DIP or something.
I just would like to hijack the reference chain to do something 
like:

```d
void fun()
{
   ref T rs;

   scope(failure)
   {
     rs.close();
   }

   rs = query();
   otherFunc(rs);
}
```

I removed the ref and changed my code to use pointers instead.


More information about the Digitalmars-d-learn mailing list