...
This commit is contained in:
@@ -58,10 +58,23 @@ concept mcc_error_c = std::default_initializable<T> && (std::convertible_to<T, b
|
||||
|
||||
|
||||
template <mcc_error_c ErrT, mcc_error_c DefErrT>
|
||||
DefErrT mcc_deduced_err(ErrT const& err, DefErrT const& default_err)
|
||||
auto mcc_deduced_err(ErrT const& err, DefErrT const& default_err)
|
||||
// DefErrT mcc_deduced_err(ErrT const& err, DefErrT const& default_err)
|
||||
{
|
||||
if constexpr (std::same_as<ErrT, DefErrT>) {
|
||||
return err;
|
||||
} else if constexpr (std::is_error_code_enum_v<DefErrT>) {
|
||||
if constexpr (std::same_as<ErrT, std::error_code>) {
|
||||
return err;
|
||||
} else {
|
||||
return default_err;
|
||||
}
|
||||
} else if constexpr (std::is_error_condition_enum_v<DefErrT>) {
|
||||
if constexpr (std::same_as<ErrT, std::error_condition>) {
|
||||
return err;
|
||||
} else {
|
||||
return default_err;
|
||||
}
|
||||
} else {
|
||||
return default_err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user