How to properly access mapped memory without undefined behavior in C++
问题 I've been trying to figure out how to access a mapped buffer from C++17 without invoking undefined behavior. For this example, I'll use a buffer returned by Vulkan's vkMapMemory. So, according to N4659 (the final C++17 working draft), section [intro.object] (emphasis added): The constructs in a C++ program create, destroy, refer to, access, and manipulate objects. An object is created by a definition (6.1), by a new-expression (8.3.4), when implicitly changing the active member of a union (12