What does foo()=default; do?
It's a defualted function. It tells the compiler to generate the function definition as it normally would if that function were to be defined. When you overload any constructor, C++ ellides the default constructor by default (though not the copy constructor). If you want a default constuctor, you can use =default. This has a few important differences with definining an empty default constructor wrt triviality (a new type property in C++11), eg.
// no default constructor
struct foo {
int i;
foo(int i) : i(i) {}
};
// trivial default constructor
struct foo {
int i;
foo() = default;
foo(int i) : i(i) {}
};
// non-trivial default constructor
struct foo {
int i = 0;
foo() = default;
foo(int i) : i(i) {}
};
Being trivial means there's no actual code generated. The constructor doesn't actually do anything - it doesn't set any member variables, it does nothing at all, and so optimizations can be applied that ellide the call to the default constructor entirely. The first example doesn't define a default constructor but does define another constructor, so there will be no default constructor (you must supply the argument). The third case requires the default constructor to initialize i to 0, so there is code that must run, and so it is not trivial.
You can use =default with default constructors, copy constructors and assignment operators, and move constructors and move assignment operators. You can also use =delete in order to tell the compiler not to generate a function at all even if it normally would (and this cna be used for overload handling). e.g., to make a type non-copyable in C++11, do:
struct foo {
foo(foo const&) = delete;
foo& operator=(foo const&) = delete;
};
That code just means that there is no copy constructor or assignment operator and any attempts to invoke them (either implicitly or explicitly) will fail at compile time (with a far better and more helpful message than you'd get with the old C++98 private copy constructor trick). You can also use it for overloading for tricky overload sets, templates, etc.