I have a class which is entirely static. Inside the class is a pointer to a list of integers of variable length. The functions inside the class depend on the first value in the list being initialized to 2 before they are called. Some of the functions are also called very frequently so I don't want to set that value first thing in every function.
Here is an example of the header:
class Foo{
public:
static void f1();
private:
static int* list;
}
and the .cpp file, globally (outside other function calls):
int* Foo::list = new int[10];
I need to initialize list[0] =2 somehow but that is not allowed in the same location as I have the list initializer.
Foo".staticis not on your definition in real life, since it is invalid.