I am actually not really aware if you can declare a class and then use a static instance it among several objects of the same class. More specifically:
class State {
public:
State();
static CustomNumberDist normal_dist;
private:
int id;
};
So every instance of State should contain the same instance of CustomNumberDist. I compiles but I am wondering if it is valid or I may run into problems later on.
The declaration (header file i.e. .h) that you have given is perfectly valid.
However in the definition (.cpp file) you need
As memory will be required for the static object when you get to the linking stage.