14[[noreturn]]
void Abort()
noexcept;
26class SelectValue final {
28 constexpr SelectValue() =
default;
30 constexpr SelectValue& ForLibCpp64(T value)
noexcept {
31 return Set(Bits::k64, StdLibs::kCpp, value);
34 constexpr SelectValue& ForLibStdCpp64(T value)
noexcept {
35 return Set(Bits::k64, StdLibs::kStdCpp, value);
38 constexpr SelectValue& ForLibCpp32(T value)
noexcept {
39 return Set(Bits::k32, StdLibs::kCpp, value);
42 constexpr SelectValue& ForLibStdCpp32(T value)
noexcept {
43 return Set(Bits::k32, StdLibs::kStdCpp, value);
46 constexpr SelectValue& For64Bit(T value)
noexcept {
47 return Set(Bits::k64, StdLibs::kAny, value);
50 constexpr SelectValue& For32Bit(T value)
noexcept {
51 return Set(Bits::k32, StdLibs::kAny, value);
54 constexpr operator T()
const noexcept {
55 if (has_stdlib_value_) {
57 }
else if (has_bits_value_) {
76 constexpr SelectValue& Set(Bits bits, StdLibs lib, T value)
noexcept {
77 constexpr auto kBits = (
sizeof(
void*) == 8 ? Bits::k64 : Bits::k32);
79#if defined(_LIBCPP_VERSION)
88 has_stdlib_value_ =
true;
89 stdlib_value_ = value;
90 }
else if (lib == StdLibs::kAny) {
91 has_bits_value_ =
true;
101 bool has_stdlib_value_ =
false;
102 bool has_bits_value_ =
false;
107using SelectSize = SelectValue<std::size_t>;