While indeed, C++ does not have static blocks as part of the language, you can implement static blocks without you (as a user) having to use any classes or namespaces, and can write:
#include "static_block.h"
static_block {
int x = 1;
int y = 2;
int z = x+y;
std::cout << z << " = " << x " << " + " << y << "\n";
}
or whatever else you want. You can't have those within classes, though, just at file scope. See a detailed description of these in my answer to a related question, and the code for static_block.h
here.
Note: This does not require C++11 and will work well with old compilers.