Better way to achieve the following

Steven Schveighoffer schveiguy at gmail.com
Tue Jun 21 17:31:56 UTC 2022


On 6/21/22 1:19 PM, JG wrote:
> On Tuesday, 21 June 2022 at 17:15:02 UTC, Steven Schveighoffer wrote:
>> On 6/21/22 1:09 PM, JG wrote:
>>> Thoughts?
>>
>> Use a pointer? Especially if you are using `.method` calls, this just 
>> works seamlessly.
>>
> 
> Thanks for the suggestion.  My immediate reaction is that for `.method` 
> calls I would agree, but for assignments it is slightly less pleasant. 
> Perhaps it is the best option.

I use pointers for this purpose all the time. It's what they are for (to 
point at something).

They even work in safe functions with dip1000 turned on.

Yes it can get tedious to have to dereference in many cases. But at 
least if you forget and assign to `t` instead of `*t`, it probably 
doesn't compile.

-Steve


More information about the Digitalmars-d-learn mailing list