I have a question with singlton.
Where should I declare the static member of the singleton class?
why not working like this
class singleton{
  private:
  static singleton & m_singleton;
  public:
  static singleton& get_instance{
          return m_singleton;
  }
}
but I have to be like this
class singleton{
  public:
  static singleton& get_instance{
     static singleton & m_singleton;
          return m_singleton;
  }
}
What's the differnece?
I know there is another way to use pointer, but now I am only talking about the case to use an object.
Also another questions, what's the pros/cons to use pointer and reference for singleton ?
Thanks so much!
 
     
    