Fix build errors after upgrading to C++11.
Use unique_ptr instead of auto_ptr.