C++11

Reference #1401.

Change much stuff to use new library.
Why remove this? It should be possible to implement this using C++11's facilities.