algo: converted from memcpy to std::copy.