AA and struct with const member

Era Scarecrow rtcvb32 at yahoo.com
Tue Dec 28 14:48:24 UTC 2021

On Tuesday, 28 December 2021 at 07:51:04 UTC, frame wrote:
> On Tuesday, 28 December 2021 at 01:45:42 UTC, Era Scarecrow 
> wrote:
>>  Success!
>>  So i summarize, either work with a pointer, or drop the 
>> const...
> Of course casting the const away was the first thing I did but 
> I think this is not very clean :D

Well the next step up would be if the key does exist, you could 
then memcpy the result... which can have issues with non-native 
basic types.

  Probably better to make data private vs making it const. I tend 
to use const far more as input arguments to help denote it won't 
change references and less for elements in a struct. That or make 
it a class? I'm not sure.

More information about the Digitalmars-d-learn mailing list