Why is `Appender._data` a pointer to its `Data`-store?

Steven Schveighoffer schveiguy at gmail.com
Sat Oct 17 00:06:31 UTC 2020


On 10/16/20 5:40 PM, Per Nordlöw wrote:
> Why is `Appender`'s store `Data` put directly as
> 
>      `private Data* _data;`
> 
> instead of
> 
>      `private Data _data;`
> 
> ?
> 
> Removing the pointer indirection would give better locality.
> 
> If it's about optimizing for empty `Appender`s then a `Appender*` should 
> be used in those cases instead.

Appender is ref counted IIRC.

-Steve


More information about the Digitalmars-d-learn mailing list