Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct DefaultCompare
- {
- template<typename T1, typename T2>
- static xht_forceinline std::enable_if_t<
- !(std::is_floating_point_v<T1> && std::is_floating_point_v<T2>),
- bool
- > Compare(const T1& t1, const T2& t2)
- {
- return t1 == t2;
- }
- template<typename T1, typename T2>
- static xht_forceinline std::enable_if_t<
- std::is_floating_point_v<T1> && std::is_floating_point_v<T2>,
- bool
- > Compare(const T1& t1, const T2& t2)
- {
- using T3 = std::common_type_t<T1, T2>;
- T3 x = t1;
- T3 y = t2;
- return !memcmp(&x, &y, sizeof(T3));
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement