Currently is_small disables local storage according to std::uses_allocator. If uses_allocator returns false_type and local storage is applied, then construct and destroy don't get called.
Instead, construct and destroy should be applied to the local storage. A copy of the allocator needs to be saved to call destroy, but hopefully this can be avoided.
Detect whether the allocator actually implements destroy; if not, use ordinary destruction.
If the allocator is scoped_allocator_adaptor and get_allocator() works on the target, then it would be nice to use that for destruction. But, that would be too presumptuous. It might be OK to check for implementation of destroy on scoped_allocator_adaptor::outer_allocator_type. A more generic means would be nice.
Currently
is_smalldisables local storage according tostd::uses_allocator. Ifuses_allocatorreturnsfalse_typeand local storage is applied, thenconstructanddestroydon't get called.Instead,
constructanddestroyshould be applied to the local storage. A copy of the allocator needs to be saved to calldestroy, but hopefully this can be avoided.Detect whether the allocator actually implements
destroy; if not, use ordinary destruction.If the allocator is
scoped_allocator_adaptorandget_allocator()works on the target, then it would be nice to use that for destruction. But, that would be too presumptuous. It might be OK to check for implementation ofdestroyonscoped_allocator_adaptor::outer_allocator_type. A more generic means would be nice.