forward tuple arg to local variable + dtor

Stanislav Blinov stanislav.blinov at gmail.com
Sat Jan 22 19:17:30 UTC 2022


On Saturday, 22 January 2022 at 18:00:58 UTC, vit wrote:

> I want implement something like this:

Scratch the previous reply, 'twas a brain fart... Simply take by 
value, no need for extra copies at all in that case. Arguments 
themselves will become those copies as needed.

```d
import std.meta : allSatisfy;

enum bool isRcPtr(T) = is(T == RcPtr!U, U);

//@safe access to data of multiple ref counted objects:
public auto apply(alias fn, Args...)(Args args)
if (allSatisfy!(isRcPtr, Args)) {

     @property auto ref elm(alias param)()@trusted{
         return param.get();
     }

     return fn(staticMap!(elm, args));
}
```


More information about the Digitalmars-d-learn mailing list