Skip to content

Commit

Permalink
Simplify fstring
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
  • Loading branch information
phprus committed Oct 4, 2024
1 parent 22701d5 commit a9b3aa0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions include/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -2652,7 +2652,7 @@ template <typename... T> struct fstring {
static_assert(count<(std::is_base_of<view, remove_reference_t<T>>::value &&
std::is_reference<T>::value)...>() == 0,
"passing views as lvalues is disallowed");
if (FMT_USE_CONSTEVAL) parse_format_string<char>(s, checker(s, arg_pack()));
if (FMT_USE_CONSTEVAL) parse_format_string<char>(str, checker(str, arg_pack()));
#ifdef FMT_ENFORCE_COMPILE_STRING
static_assert(
FMT_USE_CONSTEVAL && sizeof(s) != 0,
Expand All @@ -2662,9 +2662,8 @@ template <typename... T> struct fstring {
template <typename S,
FMT_ENABLE_IF(std::is_convertible<const S&, string_view>::value)>
FMT_CONSTEVAL FMT_ALWAYS_INLINE fstring(const S& s) : str(s) {
auto sv = string_view(str);
if (FMT_USE_CONSTEVAL)
detail::parse_format_string<char>(sv, checker(sv, arg_pack()));
detail::parse_format_string<char>(str, checker(str, arg_pack()));
#ifdef FMT_ENFORCE_COMPILE_STRING
static_assert(
FMT_USE_CONSTEVAL && sizeof(s) != 0,
Expand Down

0 comments on commit a9b3aa0

Please sign in to comment.