Fixing compile errors

This commit is contained in:
Crzyrndm 2018-08-18 16:51:53 +12:00
parent 7b05beae90
commit 6aa10131a2
2 changed files with 5 additions and 5 deletions

View File

@ -53,8 +53,8 @@ class optional
/// <summary>
/// Default equality operation, just uses operator==
/// </summary>
template <typename T, typename std::enable_if<!std::is_floating_point_v<T>>::type * = nullptr>
constexpr bool compare_equal(const T &lhs, const T &rhs) const
template <typename U = T, typename std::enable_if<!std::is_floating_point<U>::value>::type * = nullptr>
constexpr bool compare_equal(const U &lhs, const U &rhs) const
{
return lhs == rhs;
}
@ -62,8 +62,8 @@ class optional
/// <summary>
/// equality operation for floating point numbers. Provides "fuzzy" equality
/// </summary>
template <typename T, typename std::enable_if<std::is_floating_point_v<T>>::type * = nullptr>
constexpr bool compare_equal(const T &lhs, const T &rhs) const
template <typename U = T, typename std::enable_if<std::is_floating_point<U>::value>::type * = nullptr>
constexpr bool compare_equal(const U &lhs, const U &rhs) const
{
return detail::float_equals(lhs, rhs);
}

View File

@ -90,7 +90,7 @@ float_equals(const LNumber &lhs, const RNumber &rhs,
return false;
}
// a type that lhs and rhs can agree on
using common_t = std::common_type_t<LNumber, RNumber>;
using common_t = std::common_type<LNumber, RNumber>::type;
// epsilon type defaults to float because even if both args are a higher precision type
// either or both could have been promoted by prior operations
// if a higher precision is required, the template type can be changed