Fixes to make it compile on older GCC, with just C++0x support (no for range).
Merge remote-tracking branch 'mybook/master'. Compiles with C++0x.