Cannot make my shared PureMallocator callable in pure functions

Steven Schveighoffer schveiguy at yahoo.com
Sat Feb 17 14:04:37 UTC 2018


On 2/17/18 8:32 AM, ag0aep6g wrote:
> On 02/17/2018 01:35 PM, rikki cattermole wrote:
>> pure means no globals. As in none :)
> 
> ... except immutable ones. And since PureMallocator has no fields, 
> `instance` can be made immutable, and all the methods can be made static 
> or const. Then they can be used in `pure` code.

You have to be a bit careful here. pure functions can assume nothing is 
happening and simply not call the function.

-Steve


More information about the Digitalmars-d-learn mailing list