Passing structs to functions

Namespace via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 2 14:23:57 PDT 2016


On Saturday, 2 July 2016 at 21:19:04 UTC, ketmar wrote:
> On Saturday, 2 July 2016 at 21:17:33 UTC, Namespace wrote:
>> On Saturday, 2 July 2016 at 21:15:29 UTC, ketmar wrote:
>>> On Saturday, 2 July 2016 at 21:05:18 UTC, Namespace wrote:
>>>> Try this little trick:
>>>
>>> or don't. such pointers to structs are *dangerous*.
>>
>> Either that "dangerous" thing or 2^N template bloat.
>
> not "dangerous", but *dangerous*.

I see no real danger in that code snippet of mine. 'auto ref' is 
the wrong solution since it leads to 2^N template bloat and 
passing by value is only a good solution if your struct is really 
small.


More information about the Digitalmars-d-learn mailing list