const-correct structs, best practices?
Nick Sabalausky via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Aug 21 09:31:33 PDT 2015
On 08/21/2015 12:22 PM, Dicebot wrote:
> On Friday, 21 August 2015 at 15:00:04 UTC, Nick Sabalausky wrote:
>> Is there a good posting somewhere that summarizes the current best
>> practices for making const-correct (ie works for all of
>> mutable/const/immutable) structs?
>
> - mark methods const
> - avoid reference type fields
>
> ;)
What about inout?
I have a struct that supports operator overloading, returning the
struct's own type. After fiddling with that, I got a good laugh out of
Meta's comment, and I think he may be right!
More information about the Digitalmars-d-learn
mailing list