[C++11] Use std::unique_ptr for ownership in a vector.

Also change to using range-based for loops. No functional change intended.