38 #ifndef __CPU_INST_RES_HH__
39 #define __CPU_INST_RES_HH__
42 #include <type_traits>
54 std::function<bool(
const std::any &
a,
const std::any &
b)>
equals;
63 return !
b.has_value();
74 if (
a.has_value() !=
b.has_value())
82 if (
a.type() !=
b.type())
85 return std::any_cast<const T&>(
a) == std::any_cast<const T&>(
b);
88 static_assert(!std::is_pointer_v<T>,
89 "InstResult shouldn't point to external data.");
92 static_assert(!std::is_floating_point_v<T>,
93 "Floating point values should be converted to/from ints.");
98 std::enable_if_t<std::is_floating_point_v<T>,
int> = 0>
102 template <
typename T,
103 std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, RegVal>,
134 template <
typename T>
138 static_assert(!std::is_floating_point_v<T>,
139 "Floating point values should be converted to/from ints.");
140 return result.type() ==
typeid(T);
143 template <
typename T>
144 std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, RegVal>,
bool>
156 template <
typename T>
161 return std::any_cast<T>(
result);
164 template <
typename T>
165 std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, RegVal>,
176 template <
typename T>
190 #endif // __CPU_INST_RES_HH__