Is this a good pattern for allocation?

Tobias Pankrath tobias at pankrath.net
Mon Aug 5 05:41:17 PDT 2013


On Monday, 5 August 2013 at 08:11:59 UTC, JS wrote:

> I guess you mean that I should use a template as a factory 
> instead of an interface? I'll have to think about it to see 
> what the pro's and con's of each are. The interface pattern 
> should include the template pattern though. (after all, the 
> interface is parameterized...)

If you want to swap your allocators at runtime than an interface 
is a good solution. They are here for runtime dispatch after all. 
However all your allocators are forced to be classes.

Coincidentally an article has been written about exactly this 
maybe a week ago.
See 
http://blog.thecybershadow.net/2013/07/28/low-overhead-components/ 
.




More information about the Digitalmars-d-learn mailing list