Skip to content

Commit

Permalink
Merge branch 'master' of github.com:motis-project/utl
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Mar 4, 2024
2 parents 138a9d2 + e88570e commit 4e0e1eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions include/utl/parser/cstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <cassert>
#include <cctype>
#include <cstring>
#include <cstdint>

#include <algorithm>
#include <limits>
Expand Down
10 changes: 5 additions & 5 deletions include/utl/verify.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
namespace utl {

template <typename... FmtArgs>
std::runtime_error fail(fmt::format_string<FmtArgs...> msg, FmtArgs... args) {
std::runtime_error fail(std::string_view msg, FmtArgs... args) {
using clock = std::chrono::system_clock;

auto const now = clock::to_time_t(clock::now());
Expand All @@ -40,15 +40,15 @@ std::runtime_error fail(fmt::format_string<FmtArgs...> msg, FmtArgs... args) {

fmt::print(std::clog, "{} [VERIFY FAIL] ",
fmt::streamed(std::put_time(&tmp, "%FT%TZ")));
fmt::print(std::clog, msg, std::forward<FmtArgs>(args)...);
fmt::print(std::clog, fmt::runtime(msg), std::forward<FmtArgs>(args)...);
fmt::print(std::clog, "\n");

return std::runtime_error{fmt::format(msg, std::forward<FmtArgs>(args)...)};
return std::runtime_error{
fmt::format(fmt::runtime(msg), std::forward<FmtArgs>(args)...)};
}

template <typename... FmtArgs>
void verify(bool condition, fmt::format_string<FmtArgs...> msg,
FmtArgs... args) {
void verify(bool condition, std::string_view msg, FmtArgs... args) {
if (!condition) {
UTL_UNLIKELY throw fail(msg, std::forward<FmtArgs>(args)...);
}
Expand Down

0 comments on commit 4e0e1eb

Please sign in to comment.