4 ms·
No, it'd be a hybrid between a mutable and immutable struct. This allows you to control on a per-field basis whether the field is mutable or immutable.
by eigenspace 4y ago
No, it'd be a hybrid between a mutable and immutable struct. This allows you to control on a per-field basis whether the field is mutable or immutable.
- t6jvcereio 4y agoI get that, but my question is: if a type is mutable and I instantiate with const, will the exact same optimizations available?
- adgjlsfhk1 4y agothis isn't about instantiating a struct, this is about specifying that the field of a struct is const.
- t6jvcereio 4y agoOh fields. Got it.
- ChrisRackauckas 4y agoA mutable struct which labels all fields as const is an immutable struct. And yes it optimizes.