What’s the C++ idiom equivalent to the Java static block?
You can have static blocks in C++ as well – outside classes. It turns out we can implement a Java-style static block, albeit outside of a class rather than inside it, i.e. at translation unit scope. The implementation is a bit ugly under the hood, but when used it’s quite elegant! Downloadable version There’s now … Read more