▲ | jcelerier 5 days ago | |
> Making new data structure is common. Serializing classes into buffers is common. You don't want std::launder for any of that. If you must create object instances from random preexisting bytes you want std::bit_cast or https://en.cppreference.com/w/cpp/memory/start_lifetime_as.h... | ||
▲ | TuxSH 4 days ago | parent [-] | |
Alas none of gcc/clang/msvc(?) have implemented start_lifetime_as, so if you want to create an object in-place and obtain a mutable pointer to it, you're stuck with the:
trick until they properly implement it. For MMIO, reintepret_cast from integer is most likely fine. |