Adapt any string-like type to be used by {fmt} just like the standard string types already supported. The adaption is totally non-intrusive.
Signed-off-by: Daniela Engert <dani@ngrt.de>
This commit is contained in:
committed by
Victor Zverovich
parent
846c644e84
commit
2c81c851b2
@@ -606,7 +606,7 @@ inline FMT_ENABLE_IF_STRING(S, std::basic_string<FMT_CHAR(S)>)
|
||||
typedef internal::basic_buffer<FMT_CHAR(S)> buffer;
|
||||
typedef typename printf_context<buffer>::type context;
|
||||
format_arg_store<context, Args...> as{ args... };
|
||||
return vsprintf(internal::to_string_view(format_str),
|
||||
return vsprintf(to_string_view(format_str),
|
||||
basic_format_args<context>(as));
|
||||
}
|
||||
|
||||
@@ -637,7 +637,7 @@ inline FMT_ENABLE_IF_STRING(S, int)
|
||||
typedef internal::basic_buffer<FMT_CHAR(S)> buffer;
|
||||
typedef typename printf_context<buffer>::type context;
|
||||
format_arg_store<context, Args...> as{ args... };
|
||||
return vfprintf(f, internal::to_string_view(format_str),
|
||||
return vfprintf(f, to_string_view(format_str),
|
||||
basic_format_args<context>(as));
|
||||
}
|
||||
|
||||
@@ -664,7 +664,7 @@ inline FMT_ENABLE_IF_STRING(S, int)
|
||||
typedef internal::basic_buffer<FMT_CHAR(S)> buffer;
|
||||
typedef typename printf_context<buffer>::type context;
|
||||
format_arg_store<context, Args...> as{ args... };
|
||||
return vprintf(internal::to_string_view(format_str),
|
||||
return vprintf(to_string_view(format_str),
|
||||
basic_format_args<context>(as));
|
||||
}
|
||||
|
||||
@@ -696,7 +696,7 @@ inline FMT_ENABLE_IF_STRING(S, int)
|
||||
typedef internal::basic_buffer<FMT_CHAR(S)> buffer;
|
||||
typedef typename printf_context<buffer>::type context;
|
||||
format_arg_store<context, Args...> as{ args... };
|
||||
return vfprintf(os, internal::to_string_view(format_str),
|
||||
return vfprintf(os, to_string_view(format_str),
|
||||
basic_format_args<context>(as));
|
||||
}
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
Reference in New Issue
Block a user