You can use static variable inside of function call. It will be initialized once (with your init value or with zero(s) by default) the function is called first time and the line of code of that value initalization is reached. For class variable a constructor will be called at this point. The value will not be reassigned each time the function is being called.
There is no guaranteed order of initialization of global variables.
Using std::map template be aware: doing a lookup with [] operator is not safe. If the key does not exist, a new entry for the key will be created with a mapped value by default for mapped type. No exception will be thrown. Use find() instead to handle such a case properly.