I was reading the answers to the question. C++ Singleton design pattern
One of the answer suggested to use shared_ptr to guarantee the lifetime when multiple static objects access the singleton object. I noticed that shared_ptr here is constructed using new and is returned by value.
Is using new for shared_ptr construction atomic/thread_safe?
My second confusion is regarding RVO. I tried creating two singleton objects in my implementation.
The shared_ptr shows three _Uses and one _Weak. I expected _Uses count to be two. Optimization is full on Visual Studio 15.5.6. Is RVO not functioning here?
class Singleton
{
public:
    Singleton(Singleton const&) = delete;
    Singleton& operator=(Singleton const&) = delete;
static std::shared_ptr<Singleton> instance()
{
    static std::shared_ptr<Singleton> s{new Singleton};
    return s;
}
    ~Singleton() {}
private:
    Singleton() {}
};
int main()
{
     std::shared_ptr<Singleton> obj1 = Singleton::instance();
     std::shared_ptr<Singleton> obj2 = Singleton::instance();
     return 0;
}
 
    