I create an instance of object and get a pointer to that then pass into a function. The function responsible for capturing that pointer and storing it inside an unordered_map.
I made several attempts to make it compile but none of them works.
#include <iostream>
#include <memory>
#include <unordered_map>
struct Foo {
    std::string name;
};
std::unordered_map<std::string, std::shared_ptr<Foo>> zoo;
void bar(Foo *foo) {
    zoo.emplace("zilla", std::move(std::make_shared<Foo>(foo)));
}
int main()
{
    // Normal
    Foo foo;
    foo.name = "Stackoverflow";
    
    // Get Pointer
    Foo *fuzzy = &foo;
    
    bar(fuzzy);
    return 0;
}
What should be the correct way to call make_shared in this case?
Note that I don't want to create the shared_ptr for the pointer rather the object itself.
 
     
     
    