std::copy is wrong here, though, since it does a forward copy. You need std::reverse_copy.