3 ms·
> If you refactor your object construction into factory functions Given this article is about c++, no need for factory patterns or anything like that. You can
by maccard 8y ago
> If you refactor your object construction into factory functions
Given this article is about c++, no need for factory patterns or anything like that. You can overload the new operator on a global, and a per type basis and do it that way.
- majewsky 8y agoA potential problem with "operator new" is that it you can only have one allocator per type for the entire process. When you explicitly pass a factory, you can have separate factory instances.
- AstralStorm 8y agoOr if you template your types on an allocator, like STL does in some cases.