Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Little example for static initialization in C++.
#include <iostream>
using namespace std;
struct foo {
foo() : data(1) { }
int data;
};
static foo bar;
int main() {
cout << bar.data << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment