What is a static constructor?

C++ doesn’t have static constructors but you can emulate them using a static instance of a nested class.

class has_static_constructor {
    friend class constructor;

    struct constructor {
        constructor() { /* do some constructing here … */ }
    };

    static constructor cons;
};

// C++ needs to define static members externally.
has_static_constructor::constructor has_static_constructor::cons;

In C++, there is no static constructor. In C# (and probably in Java too), you can define static constructor which is called automatically by the runtime so as to initialize static members.

For further question and interest you can read this topic:

What is the rationale for not having static constructor in C++?