Namespaces
Variants
Views
Actions

Talk:cpp/types/byte

From cppreference.com

For std::to_integer(std::byte b), shouldn't this statement:

"This overload only participates in overload resolution if std::is_integral_v<IntegerType> is true."

really be:

"This overload only participates in overload resolution if std::is_unsigned_v<IntegerType> is true."

The std::byte proposal at http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0298r3.pdf says in the Design Decisions section, when talking about to_integer():

"As its underlying type is unsigned char, to facilitate bit twiddling operations, convenience conversion operations are provided for mapping a byte to an unsigned integer type value." 173.8.209.125 12:47, 4 April 2017 (PDT)

The "Design Decisions" section doesn't matter. The wording section is what actually went into the standard, and that uses std::is_integral_v. I suggest checking with the proposal's author to see if the wording reflects his intent or if it's an oversight that should be corrected via a defect report. T. Canens (talk) 12:55, 4 April 2017 (PDT)

Thanks for the clarification!

[edit] This page is hard to find

When I search for either byte or std::byte, I am always redirected to cpp/error/errc, which is far from being helpful (even before the introduction of std::byte…). —Ltrlg (talk) 07:43, 21 January 2020 (PST)

works for me, must be one of those glitches the built-in search sometimes has. --Cubbi (talk) 11:46, 21 January 2020 (PST)