Create a derived class to provide a trivial construct.
struct D : T { D() {}
Build a derived class, but assign it to the generic pointer you want.
std::shared_ptr< T > p = std::make_shared< D >();
Demo version
Note that this is type safe with respect to the destructor. shared_ptr always erases styles and uses dynamic dispatch before calling the destructor, even for simple POD objects.
source share