Simplify fmt::throw_exception

Gradual exception deprecation: disallow choosing exception type.
However, the function itself can remain here forever.
This commit is contained in:
Nekotekina 2019-11-08 00:36:59 +03:00
parent b338014639
commit 587ae17aa2
6 changed files with 11 additions and 24 deletions

View file

@ -259,25 +259,13 @@ namespace fmt
throw std::range_error{out};
}
// Hidden template
template <typename T>
void raw_throw_exception(const char* fmt, const fmt_type_info* sup, const u64* args)
{
std::string out;
raw_append(out, fmt, sup, args);
throw T{out};
throw std::runtime_error{out};
}
// Explicit instantiations (not exhaustive)
template void raw_throw_exception<std::runtime_error>(const char*, const fmt_type_info*, const u64*);
template void raw_throw_exception<std::logic_error>(const char*, const fmt_type_info*, const u64*);
template void raw_throw_exception<std::domain_error>(const char*, const fmt_type_info*, const u64*);
template void raw_throw_exception<std::invalid_argument>(const char*, const fmt_type_info*, const u64*);
template void raw_throw_exception<std::out_of_range>(const char*, const fmt_type_info*, const u64*);
template void raw_throw_exception<std::range_error>(const char*, const fmt_type_info*, const u64*);
template void raw_throw_exception<std::overflow_error>(const char*, const fmt_type_info*, const u64*);
template void raw_throw_exception<std::underflow_error>(const char*, const fmt_type_info*, const u64*);
struct cfmt_src;
}