When using sharing, you cannot specify how the allocation and release of the held object will be performed.
If necessary, use std::allocate_shared<T> instead:
std::vector<std::shared_ptr<std::string>> avec; std::allocator<std::string> aAllocator; avec.push_back(std::allocate_shared<std::string>(aAllocator,"hi there!"));
Please note that the vector should not be informed about the dispenser!
To create a custom dispenser, see here https://stackoverflow.com/a/166778/
Johan Lundberg Nov 04 2018-12-12T00: 00Z
source share