The C++ equivalent is... it just works. Static variables in a function are initialized exactly once the first time a function is entered per the language definition.
This is one of the many great improvements of C++11
This is one of the many great improvements of C++11