In the following code snippet. The static member variable map is initializes using its default constructor.
#include <iostream>
#include <map>
using namespace std;
class A
{
static map<int, int> m_map; //static member variable
public:
void PrintSize()
{
//accessing it
//so that the map gets into the executable
cout < m_map.size() << endl;
}
};
// Initializing the static map member variable
map<int, int> A::m_map = map<int, int>();
int main()
{
A a;
cout << sizeof(a) << endl;
a.PrintSize();
return 0;
}
The program runs fine. My question is that where is the temporary variable formed to initialize the static map stored?