These two do not contradict each other. Distributors are the PolicyPattern or StrategyPattern used by the container adapters of the STL libraries to allocate pieces of memory for use with objects.
These allocators often optimize memory allocation by allowing * ranges of elements to be allocated immediately and then initialized using a new placement * elements to be selected from secondary specialized heaps depending on the block.
One way or another, the end result will (almost always) be that objects are assigned a new one (placement or default)
Another striking example is, for example, the boost library implements intelligent controllers. Because smart controllers are very small (with little overhead), distribution overhead can be a burden. For implementation, it would be advisable to define a specialized distributor for executing distributions, so one could have efficient std :: set <> smart pointers, std :: map <..., smartpointer>, etc.
(Now I'm almost sure that the upgrade actually optimizes memory for most smart controllers, avoiding any virtual machines, so vft, making the class a POD structure, with only the raw pointer as storage, some of the examples will not apply. But again, extrapolate to others types of smartpointer (refcounting smartpointers, pointers to member functions, pointers to member functions with reference to an instance, etc.).
sehe Apr 11 2018-11-11T00: 00Z
source share