Hi!
The short answer - you always have to initialize static variables. If a struct doesn’t have a proper constructor you will need to inizialize it’s variables. I don’t thing that keeping InputMode struct as a static (probably global?) thing is a good idea anyway. I’d rather create a singleton object that handles all input modes. It will also make them unique and initialized once. More about singletons in c++ here: c++ - Singleton: How should it be used - Stack Overflow
(yeah, I know that singletons are devil, but this IS the situation it fits perfectly).
The LOOOONG answer:
The first thing that needs to be understand is what statics in c++ are and how c++ is compiled. In C++ there is a concept of headers and source files, but in the end only source files are compiled and headers are glued to source files (via #include). One source file with included headers is compiled into something called a translation unit.
That leads to a situation that one header can be used in two different source files. That means we will have a two different translation units. Both of them will have a static variable, with the same name, BUT they will be two different variables, because of a rule that a that static variable in c++ is a variable that is initialized ONLY once. This is why you need to initialize them in c++ file
In your example from stack overflow there is a static block but it is defined in c++ file, so i t won’t be accessed for other files.
Hope this whole lecture helped