Use std::copy instead of custom loops to take advantage of STL optimizations.