Jonathan Wakely
Jonathan Wakely
> I haven't used the ranges library. I suspect that using it in this example would be messy. But I, too, am curious what it would look like. As suggested,...
> it is much more common and standard Citation needed. Using `#include "foo.h"` only makes a difference if the code has headers and sources files in the same directory, so...
> usually comes with using some kind of makefile/cmake or a bit more complex way of using compiler. If you're only compiling toy examples with one or two source files,...
@MikeGitb two bytes?
Passing a huge object by value might make sense if it permits guaranteed elision, rather than forcing early temporary materialization in order to bind a reference to the temporary. Unfortunately,...
> `auto ptr2 = std::bit_cast(address); // Favorable?` This might be il-formed because `sizeof(void*) == sizeof(uintptr_t)` is not necessarily true, and even if it compiles, it might give a different answer....
Your reinterpret cast examples are ok, I would not replace any of them with `std::bit_cast`.
Right. But that doesn't make much sense for Niels' examples, where he wants to read the `char` values making up the object representation of some other objects. You could read...
The reinterpret_cast itself is ok, but dereferencing the result of the cast is undefined. The bit_cast version is ok, but redundant. For two's complement integers the implicit conversion from `uint32_t`...
GCC, clang and msvc *always* implemented that rule on all supported architectures. That's why changing the standard was completely uncontroversial. It used to be implementation defined to allow for other...