File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -125,8 +125,8 @@ integral type that will fit a compile-time value.
125125
126126[source,cpp]
127127----
128- constexpr auto x = stdx::smallest_uint<42>(); // std::uint8_t{}
129- constexpr auto y = stdx::smallest_uint<1337>(); // std::uint16_t{}
128+ constexpr auto x = stdx::smallest_uint<42>(); // std::uint8_t{42 }
129+ constexpr auto y = stdx::smallest_uint<1337>(); // std::uint16_t{1337 }
130130
131131// smallest_uint_t is the type of a call to smallest_uint
132132using T = stdx::smallest_uint_t<1337>; // std::uint16_t
Original file line number Diff line number Diff line change @@ -421,13 +421,13 @@ template <typename T> constexpr auto bit_size() -> std::size_t {
421421
422422template <std::size_t N> CONSTEVAL auto smallest_uint () {
423423 if constexpr (N <= std::numeric_limits<std::uint8_t >::digits) {
424- return std::uint8_t {};
424+ return std::uint8_t {N };
425425 } else if constexpr (N <= std::numeric_limits<std::uint16_t >::digits) {
426- return std::uint16_t {};
426+ return std::uint16_t {N };
427427 } else if constexpr (N <= std::numeric_limits<std::uint32_t >::digits) {
428- return std::uint32_t {};
428+ return std::uint32_t {N };
429429 } else {
430- return std::uint64_t {};
430+ return std::uint64_t {N };
431431 }
432432}
433433
You can’t perform that action at this time.
0 commit comments