mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-29 18:27:40 +02:00
constrain templated format_to on proper format string type.
Signed-off-by: Daniela Engert <dani@ngrt.de>
This commit is contained in:
committed by
Victor Zverovich
parent
d7f17613f5
commit
4cf21f58b2
@ -266,10 +266,6 @@ template <>
|
||||
inline void reset_color<wchar_t>(FILE *stream) FMT_NOEXCEPT {
|
||||
fputs(internal::data::WRESET_COLOR, stream);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
struct is_format_string: std::integral_constant<
|
||||
bool, std::is_empty<format_string_traits<S>>::value> {};
|
||||
} // namespace internal
|
||||
|
||||
template <
|
||||
|
@ -1285,6 +1285,9 @@ struct format_string_traits<
|
||||
basic_string_view<typename S::char_type>, S>::value>::type> :
|
||||
format_string_traits_base<typename S::char_type> {};
|
||||
|
||||
template <typename S>
|
||||
struct is_format_string : std::is_empty<format_string_traits<S>> {};
|
||||
|
||||
template <typename S>
|
||||
struct is_compile_string :
|
||||
std::integral_constant<bool, std::is_base_of<compile_string, S>::value> {};
|
||||
|
@ -3507,7 +3507,8 @@ inline OutputIt vformat_to(
|
||||
\endrst
|
||||
*/
|
||||
template <typename OutputIt, typename String, typename... Args>
|
||||
inline OutputIt format_to(OutputIt out, const String &format_str,
|
||||
inline typename std::enable_if<internal::is_format_string<String>::value, OutputIt>::type
|
||||
format_to(OutputIt out, const String &format_str,
|
||||
const Args &... args) {
|
||||
internal::check_format_string<Args...>(format_str);
|
||||
typedef typename format_context_t<OutputIt, FMT_CHAR(String) >::type context_t;
|
||||
|
Reference in New Issue
Block a user