Replace shared_ptr(new X) with make_shared<X>()