diff --git a/include/fmt/compile.h b/include/fmt/compile.h index 2e166b5c..ca8b4285 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -351,6 +351,8 @@ template struct get_type_impl> { template using get_type = typename get_type_impl::type; +template struct is_static_compiled_format : std::false_type {}; + template struct text { basic_string_view data; using char_type = Char; @@ -362,6 +364,9 @@ template struct text { } }; +template +struct is_static_compiled_format> : std::true_type {}; + template constexpr text make_text(basic_string_view s, size_t pos, size_t size) { @@ -407,6 +412,9 @@ template struct field { } }; +template +struct is_static_compiled_format> : std::true_type {}; + template struct concat { L lhs; R rhs; @@ -419,6 +427,9 @@ template struct concat { } }; +template +struct is_static_compiled_format> : std::true_type {}; + template constexpr concat make_concat(L lhs, R rhs) { return {lhs, rhs}; @@ -507,19 +518,19 @@ constexpr auto compile(S format_str) { } } -template ::value)> +template < + typename CompiledFormat, typename... Args, + typename Char = typename CompiledFormat::char_type, + FMT_ENABLE_IF(internal::is_static_compiled_format::value)> std::basic_string format(const CompiledFormat& cf, const Args&... args) { basic_memory_buffer buffer; cf.format(std::back_inserter(buffer), args...); return to_string(buffer); } -template ::value)> +template < + typename OutputIt, typename CompiledFormat, typename... Args, + FMT_ENABLE_IF(internal::is_static_compiled_format::value)> OutputIt format_to(OutputIt out, const CompiledFormat& cf, const Args&... args) { return cf.format(out, args...);