patternlayout.cxx: Modernize C++.

Use some C++11 loops. Use std::unique_ptr<>. Replace string's `substr()` with
`assign()` calls.