mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-12-31 18:16:58 +00:00
Simplify error_code
This commit is contained in:
parent
56a165ecdc
commit
3aa6741b8c
@ -905,26 +905,23 @@ struct error_code
|
||||
};
|
||||
|
||||
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
|
||||
template<typename ET, typename = decltype(ET::__not_an_error)>
|
||||
error_code(const ET& value, std::nullptr_t = nullptr)
|
||||
// Common constructor
|
||||
template<typename ET>
|
||||
error_code(const ET& value)
|
||||
: value(static_cast<s32>(value))
|
||||
{
|
||||
}
|
||||
|
||||
// Error constructor
|
||||
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))
|
||||
{
|
||||
if constexpr(is_error<ET>::value)
|
||||
{
|
||||
this->value = error_report(fmt::get_type_info<fmt_unveil_t<ET>>(), fmt_unveil<ET>::get(value), nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
: 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