<div dir="ltr">Has there been any thought to to exposing the layout used by std::allocate_shared (even through std::aligned_storage so as no to reveal the internals)?<div><br></div><div>Context:</div><div>I&#39;m trying to make a cached pool the gives out std::shared_ptr&lt;T&gt;. Even if I cache the memory for T, I still hit memory allocations for the std::shared_ptr control block and that slows things down.</div><div><br></div><div>Right now to get around this, I use std::allocate_shared with a custom allocator that caches the allocation and checks to make sure that the same size/alignment is always asked for. This requires two allocations: 1) for the memory used for allocator_shared and 2) representing each pool entry with the pointer to 1) and other bookkeeping data.</div><div><br></div><div>If I could statically know the layout of 1), I could make it part of the allocation for 2).</div><div><br></div><div>This would make the standard require that std::allocate_shared only uses one allocation (it current recommends it but doesn&#39;t force it).</div></div>

