File tree 2 files changed +8
-13
lines changed
2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -45,15 +45,10 @@ class Boolean final {
45
45
Boolean operator -(const Boolean &Other) const { return Boolean (V - Other.V ); }
46
46
Boolean operator ~() const { return Boolean (true ); }
47
47
48
- explicit operator int8_t () const { return V; }
49
- explicit operator uint8_t () const { return V; }
50
- explicit operator int16_t () const { return V; }
51
- explicit operator uint16_t () const { return V; }
52
- explicit operator int32_t () const { return V; }
53
- explicit operator uint32_t () const { return V; }
54
- explicit operator int64_t () const { return V; }
55
- explicit operator uint64_t () const { return V; }
56
- explicit operator bool () const { return V; }
48
+ template <typename Ty, typename = std::enable_if_t <std::is_integral_v<Ty>>>
49
+ explicit operator Ty () const {
50
+ return V;
51
+ }
57
52
58
53
APSInt toAPSInt () const {
59
54
return APSInt (APInt (1 , static_cast <uint64_t >(V), false ), true );
Original file line number Diff line number Diff line change @@ -98,10 +98,10 @@ template <unsigned Bits, bool Signed> class Integral final {
98
98
return Integral<DstBits, DstSign>(V);
99
99
}
100
100
101
- explicit operator unsigned () const { return V; }
102
- explicit operator int64_t () const { return V; }
103
- explicit operator uint64_t () const { return V; }
104
- explicit operator int32_t () const { return V; }
101
+ template < typename Ty, typename = std:: enable_if_t <std::is_integral_v<Ty>>>
102
+ explicit operator Ty () const {
103
+ return V;
104
+ }
105
105
106
106
APSInt toAPSInt () const {
107
107
return APSInt (APInt (Bits, static_cast <uint64_t >(V), Signed), !Signed);
You can’t perform that action at this time.
0 commit comments