What is the fastest portable way to copy an array in C++
问题 This question has been bothering me for some time. The possibilities I am considering are memcpy std::copy cblas_dcopy Does anyone have any clue on what the pros and cons are with these three? Other suggestions are also welcome. 回答1: In C++ you should use std::copy by default unless you have good reasons to do otherwise. The reason is that C++ classes define their own copy semantics via the copy constructor and copy assignment operator, and of the operations listed, only std::copy respects