I know this is a bizarre thing to do, and it\'s not portable. But I have an allocated array of unsigned ints, and I occasionaly want to \"store\" a float in it. I don\'t w
This can be achieved through a simple copy:
uint32_t dst; float src = get_float(); char * const p = reinterpret_cast(&dst); std::copy(p, p + sizeof(float), reinterpret_cast(&src)); // now read dst
Copying backwards works similarly.