As output from one function, I get an object of type Foo
. As an argument to another class, I need to pass an object of type std::shared_ptr<Foo>
. How can I make the shared pointer from the original object?
This is really quite simple:
auto val = std::make_shared<Foo>(FuncThatReturnsFoo(...));
Basically, just heap allocate a new Foo
, copying/moving the result into it.