40 using type =
typename S::char_type;
50 std::use_facet<std::numpunct<wchar_t>>(loc.get<std::locale>());
51 auto separator = std::wstring();
59template <
typename Char>
63 static_assert(!std::is_same<Char, char>::value,
"");
82 static constexpr int num_static_named_args =
86 Char,
static_cast<int>(
sizeof...(T)), num_static_named_args,
101 template <
typename S,
102 FMT_ENABLE_IF(std::is_base_of<detail::compile_string, S>::value&&
103 std::is_same<typename S::char_type, Char>::value)>
116template <
typename Char,
typename... T>
119template <
typename... T>
125template <
typename... T>
127 ->
decltype(fmt::make_format_args<wformat_context>(args...)) {
128 return fmt::make_format_args<wformat_context>(args...);
131#if !FMT_USE_NONTYPE_TEMPLATE_ARGS
139template <
typename It,
typename Sentinel>
142 return {begin, end, sep};
145template <
typename Range, FMT_ENABLE_IF(!is_tuple_like<Range>::value)>
147 ->
join_view<
decltype(std::begin(range)),
decltype(std::end(range)),
149 return join(std::begin(range), std::end(range), sep);
155 return join(std::begin(list), std::end(list), sep);
158template <
typename Tuple, FMT_ENABLE_IF(is_tuple_like<Tuple>::value)>
164template <
typename Char, FMT_ENABLE_IF(!std::is_same<Char,
char>::value)>
167 -> std::basic_string<Char> {
173template <
typename... T>
175 return vformat(fmt::wstring_view(fmt), fmt::make_wformat_args(args...));
178template <
typename OutputIt,
typename... T>
181 return vformat_to(out, fmt::wstring_view(fmt),
182 fmt::make_wformat_args(args...));
187template <
typename S,
typename... T,
190 !std::is_same<Char, wchar_t>::value)>
191auto format(
const S& fmt, T&&... args) -> std::basic_string<Char> {
196template <
typename S,
typename Char = detail::format_
string_
char_t<S>,
197 FMT_ENABLE_IF(detail::is_exotic_
char<Char>::value)>
200 -> std::basic_string<Char> {
206template <
typename S,
typename... T,
210 -> std::basic_string<Char> {
215template <
typename OutputIt,
typename S,
226template <
typename OutputIt,
typename S,
typename... T,
229 !std::is_same<Char, char>::value &&
230 !std::is_same<Char, wchar_t>::value)>
231inline auto format_to(OutputIt out,
const S& fmt, T&&... args) -> OutputIt {
236template <
typename S,
typename OutputIt,
typename... Args,
248template <
typename OutputIt,
typename S,
typename... T,
253 ->
typename std::enable_if<enable, OutputIt>::type {
258template <
typename OutputIt,
typename Char,
typename... Args,
267 return {buf.out(), buf.count()};
270template <
typename OutputIt,
typename S,
typename... T,
274inline auto format_to_n(OutputIt out,
size_t n,
const S& fmt, T&&... args)
276 return vformat_to_n(out, n, fmt::basic_string_view<Char>(fmt),
280template <
typename S,
typename... T,
294 if (std::fputws(buf.
data(), f) == -1)
299 vprint(stdout, fmt, args);
302template <
typename... T>
311template <
typename... T>
313 return print(f, L
"{}\n", fmt::format(fmt, std::forward<T>(args)...));
317 return print(L
"{}\n", fmt::format(fmt, std::forward<T>(args)...));
327template <
typename... T>
330 return fmt::vformat(ts, fmt, fmt::make_wformat_args(args...));
339template <
typename... T>
344template <
typename... T>
346 print(os, L
"{}\n", fmt::format(fmt, std::forward<T>(args)...));
350template <
typename T>
inline auto to_wstring(
const T& value) -> std::wstring {
typename std::enable_if< B, T >::type enable_if_t
Definition base.h:304
#define FMT_END_EXPORT
Definition base.h:264
std::integral_constant< bool, B > bool_constant
Definition base.h:307
#define FMT_CONSTEVAL
Definition base.h:140
#define FMT_CONSTEXPR
Definition base.h:113
#define FMT_ALWAYS_INLINE
Definition base.h:243
#define FMT_BEGIN_NAMESPACE
Definition base.h:253
#define FMT_USE_CONSTEVAL
Definition base.h:118
#define FMT_ENABLE_IF(...)
Definition base.h:341
#define FMT_BEGIN_EXPORT
Definition base.h:263
void void_t
Definition base.h:328
#define FMT_END_NAMESPACE
Definition base.h:256
conditional_t< std::is_same< Char, char >::value, context, generic_context< basic_appender< Char >, Char > > buffered_context
Definition base.h:635
An implementation of std::basic_string_view for pre-C++17.
Definition base.h:515
A contiguous memory buffer with an optional growing ability.
Definition base.h:1763
FMT_CONSTEXPR void push_back(const T &value)
Definition base.h:1832
constexpr auto size() const noexcept -> size_t
Returns the size of this buffer.
Definition base.h:1805
FMT_CONSTEXPR auto data() noexcept -> T *
Returns a pointer to the buffer data (not null-terminated).
Definition base.h:1811
Parsing context consisting of a format string range being parsed and an argument counter for automati...
Definition base.h:850
A text style consisting of foreground and background colors and emphasis.
Definition color.h:236
Converts a string literal into a format string that will be parsed at compile time and converted into...
Definition printf.h:50
auto get_iterator(Buf &buf, OutputIt) -> decltype(buf.out())
Definition base.h:2126
FMT_CONSTEXPR void ignore_unused(const T &...)
Definition base.h:358
constexpr auto count_static_named_args() -> int
Definition base.h:1079
constexpr auto count_named_args() -> int
Definition base.h:1076
typename format_string_char< S >::type format_string_char_t
Definition xchar.h:44
auto write_loc(OutputIt, const loc_value &, const format_specs &, locale_ref) -> bool
Definition format.h:1982
bool_constant<!std::is_same< T, char >::value > is_exotic_char
Definition xchar.h:27
FMT_CONSTEXPR void parse_format_string(basic_string_view< Char > fmt, Handler &&handler)
Definition base.h:1646
FMT_FUNC void vformat_to(buffer< char > &buf, string_view fmt, format_args args, locale_ref loc)
Definition format-inl.h:1456
void write_buffer(std::basic_ostream< Char > &os, buffer< Char > &buf)
Definition ostream.h:55
typename V::value_type char_t
String's character (code unit) type. detail:: is intentional to prevent ADL.
Definition base.h:973
constexpr auto to_string_view(const Char *s) -> basic_string_view< Char >
Definition base.h:948
auto get_buffer(OutputIt out) -> iterator_buffer< OutputIt, T >
Definition base.h:2116
Definition PointerIntPair.h:280
FMT_CONSTEVAL FMT_ALWAYS_INLINE basic_fstring(const S &s)
Definition xchar.h:97
basic_fstring(runtime_format_string< Char > fmt)
Definition xchar.h:110
FMT_ALWAYS_INLINE basic_fstring(const S &)
Definition xchar.h:104
auto get() const -> basic_string_view< Char >
Definition xchar.h:113
Definition format-inl.h:58
auto grouping() const -> std::string
Definition format-inl.h:59
auto thousands_sep() const -> Char
Definition format-inl.h:60
#define S(label, offset, message)
Definition Errors.h:113
auto format(wformat_string< T... > fmt, T &&... args) -> std::wstring
Definition xchar.h:174
auto vformat(basic_string_view< Char > fmt, basic_format_args< buffered_context< Char > > args) -> std::basic_string< Char >
Definition xchar.h:165
buffered_context< wchar_t > wformat_context
Definition xchar.h:74
auto formatted_size(const S &fmt, T &&... args) -> size_t
Definition xchar.h:283
constexpr auto make_wformat_args(T &... args) -> decltype(fmt::make_format_args< wformat_context >(args...))
Definition xchar.h:126
basic_string_view< wchar_t > wstring_view
Definition xchar.h:72
auto format_to_n(OutputIt out, size_t n, const S &fmt, T &&... args) -> format_to_n_result< OutputIt >
Definition xchar.h:274
basic_memory_buffer< wchar_t > wmemory_buffer
Definition xchar.h:76
auto vformat_to_n(OutputIt out, size_t n, basic_string_view< Char > fmt, basic_format_args< buffered_context< Char > > args) -> format_to_n_result< OutputIt >
Definition xchar.h:261
typename basic_format_string< wchar_t, T... >::t wformat_string
Definition xchar.h:120
auto format_to(OutputIt out, wformat_string< T... > fmt, T &&... args) -> OutputIt
Definition xchar.h:179
auto to_wstring(const T &value) -> std::wstring
Converts value to std::wstring using the default format for type T.
Definition xchar.h:350
auto join(It begin, Sentinel end, wstring_view sep) -> join_view< It, Sentinel, wchar_t >
Definition xchar.h:140
void print(std::FILE *f, wformat_string< T... > fmt, T &&... args)
Definition xchar.h:303
auto vformat_to(OutputIt out, const S &fmt, basic_format_args< buffered_context< Char > > args) -> OutputIt
Definition xchar.h:219
auto runtime(wstring_view s) -> runtime_format_string< wchar_t >
Definition xchar.h:121
void vprint(std::FILE *f, wstring_view fmt, wformat_args args)
Definition xchar.h:290
void println(std::FILE *f, wformat_string< T... > fmt, T &&... args)
Definition xchar.h:312