Re:1.5 is the midpoint between 0 and infinity in Ruby
by kazinator on Friday November 27, 2020 @05:18PM
(#25233056)
Who is cppreference.com? The domain registration is concealed, just like that of the other dubious site, cplusplus.com.
I don't see any such a claim about memcpy having magic powers in the N4659 C++ draft.
All it says is that the underlying bytes of an object can be copied to an array of char, unsigned char, or std::byte. Then if that array is copied back into the object, the object subsequently holds its original value.
Anything more about memcpy comes from C by reference, and that would be about the last document on Earth to grant definedness and portability to something like this.
> Where strict aliasing prohibits examining the same memory as values of two different types, std::memcpy may be used to convert the values.
[0]: https://en.cppreference.com/w/cpp/string/byte/memcpy