3 ms·
Pass the address of the block of memory to the constructor along with your other arguments and perhaps the length of the memory block (to assert that sizeof(blo
by WorksOnRobots 13y ago
Pass the address of the block of memory to the constructor along with your other arguments and perhaps the length of the memory block (to assert that sizeof(block) >= sizeof(object)). Then use a C-style cast to cast the block of memory to your class. Construct the object like normal and return the address.