mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-03 17:38:15 +00:00
Simplify error_code
This commit is contained in:
parent
56a165ecdc
commit
3aa6741b8c
@ -905,26 +905,23 @@ struct error_code
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename ET>
|
template<typename ET>
|
||||||
struct is_error<ET, std::void_t<decltype(ET::__not_an_error)>> : std::false_type
|
struct is_error<ET, std::enable_if_t<sizeof(ET::__not_an_error) != 0>> : std::false_type
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
// Not an error constructor
|
// Common constructor
|
||||||
template<typename ET, typename = decltype(ET::__not_an_error)>
|
template<typename ET>
|
||||||
error_code(const ET& value, std::nullptr_t = nullptr)
|
error_code(const ET& value)
|
||||||
: value(static_cast<s32>(value))
|
: value(static_cast<s32>(value))
|
||||||
{
|
{
|
||||||
}
|
if constexpr(is_error<ET>::value)
|
||||||
|
{
|
||||||
// Error constructor
|
this->value = error_report(fmt::get_type_info<fmt_unveil_t<ET>>(), fmt_unveil<ET>::get(value), nullptr, 0);
|
||||||
template<typename ET, typename = std::enable_if_t<is_error<ET>::value>>
|
}
|
||||||
error_code(const ET& value)
|
|
||||||
: value(error_report(fmt::get_type_info<fmt_unveil_t<ET>>(), fmt_unveil<ET>::get(value), nullptr, 0))
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error constructor (2 args)
|
// Error constructor (2 args)
|
||||||
template<typename ET, typename T2, typename = std::enable_if_t<is_error<ET>::value>>
|
template<typename ET, typename T2>
|
||||||
error_code(const ET& value, const T2& value2)
|
error_code(const ET& value, const T2& value2)
|
||||||
: value(error_report(fmt::get_type_info<fmt_unveil_t<ET>>(), fmt_unveil<ET>::get(value), fmt::get_type_info<fmt_unveil_t<T2>>(), fmt_unveil<T2>::get(value2)))
|
: value(error_report(fmt::get_type_info<fmt_unveil_t<ET>>(), fmt_unveil<ET>::get(value), fmt::get_type_info<fmt_unveil_t<T2>>(), fmt_unveil<T2>::get(value2)))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user