Thread overview | |||||
---|---|---|---|---|---|
|
May 10, 2020 Is there a way to tell if an auto ref parameter is by ref or by value? | ||||
---|---|---|---|---|
| ||||
Ie something like.. auto Foo(T)(auto ref T x) { static if (isByRef(x)) { } else { } } |
May 10, 2020 Re: Is there a way to tell if an auto ref parameter is by ref or by value? | ||||
---|---|---|---|---|
| ||||
Posted in reply to NaN | On Sunday, 10 May 2020 at 00:33:07 UTC, NaN wrote:
> Ie something like..
>
>
> auto Foo(T)(auto ref T x)
> {
> static if (isByRef(x))
> {
> }
> else
> {
> }
> }
__traits(isRef, x)
|
May 10, 2020 Re: Is there a way to tell if an auto ref parameter is by ref or by value? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anonymouse | On Sunday, 10 May 2020 at 01:15:58 UTC, Anonymouse wrote:
> On Sunday, 10 May 2020 at 00:33:07 UTC, NaN wrote:
>> Ie something like..
>>
>>
>> auto Foo(T)(auto ref T x)
>> {
>> static if (isByRef(x))
>> {
>> }
>> else
>> {
>> }
>> }
>
> __traits(isRef, x)
Thanks :)
|
Copyright © 1999-2021 by the D Language Foundation