I'm very well aware of the general static constructor order problem, however I'm curious to know if this also applies in the case of composition.
Say I have the following:
#include <vector>
using std::vector;
class Foo
{
static vector<int> myVector;
Foo(int i) { myVector.push_back(i); }
~Foo() {}
};
vector<int> Foo::myVector;
Foo foo_1(1);
Foo foo_2(2);
do I have any assurances that myVector's ctor will be called before either of the calls to Foo's ctor?
Needless to say, testing this and finding that it does work as hoped proves nothing.