On Wed, Apr 3, 2013 at 10:53 AM, Roy Stogner <roystgnr@ices.utexas.edu> wrote:
Doesn't matter.

What C++ is doing under the hood is:

Construct A
Construct B

except in random order (which is why stuff worked fine for Ben), not
alphabetical order.

And if A's constructor calls a function dealing with B, there's
neither compile-time nor run-time analysis done to detect that and say
"whoops, let's construct B before A".


It's simply not possible Roy.  The code to do the push_back is in the same .C file with the thing it's trying to push_back on.  If you can't count on statics in the same .C file being created before you try to use them.... then we're all screwed!

That static will get created when the translation unit is loaded to run Singleton::Setup::Setup() (if not before then).  So it has to exist by the time you try to push_back to it.

Something else is happening here.

Derek