Three new utility functions in C++23
mariusbancila.ro
Three new utility functions in C++23
1–10 of 196 posts
Re: Three new utility functions in C++23
#2By not doing that you still have to do `std::is_enum_v` somewhere.
For types that aren't enums it should do nothing (maybe `std::identity`)
Re: Three new utility functions in C++23
#3Only in the parts specified by the protocol (headers etc). I encourage everyone sending data over network in a novel way to just use little-endian.
Re: Three new utility functions in C++23
#4They missed a trick with `std::to_underlying`. It should work on all types, not just enums. By not doing that you still have to do `std::is_enum_v ` somewhere. For types that aren't enums it should do nothing (maybe `std::identity`)
Re: Three new utility functions in C++23
#5Re: Three new utility functions in C++23
#6i.e., the functions documented in https://man7.org/linux/man-pages/man3/endian.3.html (why oh why are they not also documented in the GNU C Library Manual...)
Re: Three new utility functions in C++23
#7>Network protocols specify big endian for the order of transmission Only in the parts specified by the protocol (headers etc). I encourage everyone sending data over network in a novel way to just use little-endian.
Re: Three new utility functions in C++23
#8>Network protocols specify big endian for the order of transmission Only in the parts specified by the protocol (headers etc). I encourage everyone sending data over network in a novel way to just use little-endian.
That's not a good advice. Only if the sender and receiver are guaranteed to be running on little endian architecture you can make such a claim. A better advice is to always consider the endian-ness when designing protocols and have a strategy to handle it.
Re: Three new utility functions in C++23
#9I love how over the past decade my own C++ utility library has been continuously shrinking because with each update there are more and more utility functions (like the to_underlying this article mentions) and even complete libraries (like ) which replace self-written or 3rd party code.
Re: Three new utility functions in C++23
#10>Network protocols specify big endian for the order of transmission Only in the parts specified by the protocol (headers etc). I encourage everyone sending data over network in a novel way to just use little-endian.
That's not a good advice. Only if the sender and receiver are guaranteed to be running on little endian architecture you can make such a claim. A better advice is to always consider the endian-ness when designing protocols and have a strategy to handle it.