固定宽度整数类型的整数文字

Integer literal for fixed width integer types

是否有像这样的固定宽度整数类型的整数文字的一些 C++ 提案?

// i's type is unsigned int
auto i = 10u;
// j's type is uint32_t
auto j = 10u32;

是:P1280R0 Integer Width Literals(2018-10-05 发布)。

它提出了以下文字:

namespace std::inline literals::inline integer_literals {
  constexpr uint64_t operator ""u64 (unsigned long long arg);
  constexpr uint32_t operator ""u32 (unsigned long long arg);
  constexpr uint16_t operator ""u16 (unsigned long long arg);
  constexpr uint8_t operator ""u8 (unsigned long long arg);

  constexpr int64_t operator ""i64 (unsigned long long arg);
  constexpr int32_t operator ""i32 (unsigned long long arg);
  constexpr int16_t operator ""i16 (unsigned long long arg);
  constexpr int8_t operator ""i8 (unsigned long long arg);
}

及其更新 P1280R1“将 return 类型修改为 [u]int_leastXX_t 和朋友。这是为了确保我们实际上替换了 [U]INTxx_C 宏, 因为这些 return a [u]int_leastXX_t":

namespace std::inline literals::inline integer_literals {
  constexpr uint_least64_t operator ""u64 (unsigned long long arg);
  constexpr uint_least32_t operator ""u32 (unsigned long long arg);
  constexpr uint_least16_t operator ""u16 (unsigned long long arg);
  constexpr uint_least8_t operator ""u8 (unsigned long long arg);

  constexpr int_least64_t operator ""i64 (unsigned long long arg);
  constexpr int_least32_t operator ""i32 (unsigned long long arg);
  constexpr int_least16_t operator ""i16 (unsigned long long arg);
  constexpr int_least8_t operator ""i8 (unsigned long long arg);
}

有一个 2019-06-12 更新 P1280R2 使文字 consteval 而不是 constexpr