Commit 78223ca3 authored by Dominik Charousset's avatar Dominik Charousset

Remove minor optimization to avoid duplicated code

parent 5933a5f7
......@@ -48,57 +48,37 @@ public:
/// Generates a message with the INFO severity level.
template <class... Ts>
[[noreturn]] void fail(detail::format_string_with_location fwl, Ts&&... xs) {
if constexpr (sizeof...(Ts) > 0) {
auto msg = detail::format(fwl.value, std::forward<Ts>(xs)...);
reporter::instance().fail(msg, fwl.location);
} else {
reporter::instance().fail(fwl.value, fwl.location);
}
requirement_failed::raise(fwl.location);
}
/// Generates a message with the INFO severity level.
template <class... Ts>
void print_info(detail::format_string_with_location fwl, Ts&&... xs) {
if constexpr (sizeof...(Ts) > 0) {
auto msg = detail::format(fwl.value, std::forward<Ts>(xs)...);
reporter::instance().print_info(msg, fwl.location);
} else {
reporter::instance().print_info(fwl.value, fwl.location);
}
}
/// Generates a message with the DEBUG severity level.
template <class... Ts>
void print_debug(detail::format_string_with_location fwl, Ts&&... xs) {
if constexpr (sizeof...(Ts) > 0) {
auto msg = detail::format(fwl.value, std::forward<Ts>(xs)...);
reporter::instance().print_debug(msg, fwl.location);
} else {
reporter::instance().print_debug(fwl.value, fwl.location);
}
}
/// Generates a message with the WARNING severity level.
template <class... Ts>
void print_warning(detail::format_string_with_location fwl, Ts&&... xs) {
if constexpr (sizeof...(Ts) > 0) {
auto msg = detail::format(fwl.value, std::forward<Ts>(xs)...);
reporter::instance().print_warning(msg, fwl.location);
} else {
reporter::instance().print_warning(fwl.value, fwl.location);
}
}
/// Generates a message with the ERROR severity level.
template <class... Ts>
void print_error(detail::format_string_with_location fwl, Ts&&... xs) {
if constexpr (sizeof...(Ts) > 0) {
auto msg = detail::format(fwl.value, std::forward<Ts>(xs)...);
reporter::instance().print_error(msg, fwl.location);
} else {
reporter::instance().print_error(fwl.value, fwl.location);
}
}
/// Checks whether `lhs` and `rhs` are equal.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment