I don't mean to use this code in production environment, but I'm a little confuse about it.I thought it must be undefined,however,I ran this code without crash.Is this just conincidence?
#include <array>
#include <string>
auto main(int argc, char** argv) -> int {
// for (int i = 0; i < 1000; ++i) {
std::array<char, 1000> dst;
std::string src = "hello world";
memcpy(dst.data(), src.c_str(), dst.size()); // is this undefined behavior?
// }
}