Skip to content

Commit

Permalink
Simplify implementation of operator""_cf (#4349)
Browse files Browse the repository at this point in the history
  • Loading branch information
LocalSpook authored Feb 14, 2025
1 parent 0ca42e8 commit 94ab51c
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions include/fmt/compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ namespace detail {
# define FMT_COMPILE(s) FMT_STRING(s)
#endif

#if FMT_USE_NONTYPE_TEMPLATE_ARGS
template <typename Char, size_t N, fmt::detail::fixed_string<Char, N> Str>
struct udl_compiled_string : compiled_string {
using char_type = Char;
constexpr explicit operator basic_string_view<char_type>() const {
return {Str.data, N - 1};
}
};
#endif

template <typename T, typename... Tail>
auto first(const T& value, const Tail&...) -> const T& {
return value;
Expand Down Expand Up @@ -538,9 +528,7 @@ void print(const S& fmt, const Args&... args) {
#if FMT_USE_NONTYPE_TEMPLATE_ARGS
inline namespace literals {
template <detail::fixed_string Str> constexpr auto operator""_cf() {
using char_t = remove_cvref_t<decltype(Str.data[0])>;
return detail::udl_compiled_string<char_t, sizeof(Str.data) / sizeof(char_t),
Str>();
return FMT_COMPILE(Str.data);
}
} // namespace literals
#endif
Expand Down

0 comments on commit 94ab51c

Please sign in to comment.