mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-26 09:28:21 +00:00
Return iterator from format_to
This commit is contained in:
parent
a93270fd60
commit
bca9de9e68
@ -2374,15 +2374,13 @@ class basic_writer {
|
|||||||
/** Constructs a ``basic_writer`` object. */
|
/** Constructs a ``basic_writer`` object. */
|
||||||
explicit basic_writer(Range out): out_(out.begin()) {}
|
explicit basic_writer(Range out): out_(out.begin()) {}
|
||||||
|
|
||||||
void write(int value) {
|
void write(int value) { write_decimal(value); }
|
||||||
write_decimal(value);
|
void write(long value) { write_decimal(value); }
|
||||||
}
|
void write(long long value) { write_decimal(value); }
|
||||||
void write(long value) {
|
|
||||||
write_decimal(value);
|
void write(unsigned value) { write_decimal(value); }
|
||||||
}
|
void write(unsigned long value) { write_decimal(value); }
|
||||||
void write(long long value) {
|
void write(unsigned long long value) { write_decimal(value); }
|
||||||
write_decimal(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\rst
|
\rst
|
||||||
@ -2955,9 +2953,9 @@ typename basic_context<Range, Char>::format_arg
|
|||||||
|
|
||||||
/** Formats arguments and writes the output to the buffer. */
|
/** Formats arguments and writes the output to the buffer. */
|
||||||
template <typename ArgFormatter, typename Char, typename Context>
|
template <typename ArgFormatter, typename Char, typename Context>
|
||||||
void do_vformat_to(typename ArgFormatter::range out,
|
typename Context::iterator do_vformat_to(typename ArgFormatter::range out,
|
||||||
basic_string_view<Char> format_str,
|
basic_string_view<Char> format_str,
|
||||||
basic_format_args<Context> args) {
|
basic_format_args<Context> args) {
|
||||||
using iterator = internal::null_terminating_iterator<Char>;
|
using iterator = internal::null_terminating_iterator<Char>;
|
||||||
using range = typename ArgFormatter::range;
|
using range = typename ArgFormatter::range;
|
||||||
|
|
||||||
@ -3012,9 +3010,9 @@ void do_vformat_to(typename ArgFormatter::range out,
|
|||||||
|
|
||||||
Context context;
|
Context context;
|
||||||
basic_arg<Context> arg;
|
basic_arg<Context> arg;
|
||||||
};
|
} h(out, format_str, args);
|
||||||
parse_format_string(iterator(format_str.begin(), format_str.end()),
|
parse_format_string(iterator(format_str.begin(), format_str.end()), h);
|
||||||
handler(out, format_str, args));
|
return h.context.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Casts ``p`` to ``const void*`` for pointer formatting.
|
// Casts ``p`` to ``const void*`` for pointer formatting.
|
||||||
@ -3102,16 +3100,16 @@ template <typename OutputIt, typename Char = char>
|
|||||||
using format_args_t = basic_format_args<context_t<OutputIt, Char>>;
|
using format_args_t = basic_format_args<context_t<OutputIt, Char>>;
|
||||||
|
|
||||||
template <typename OutputIt, typename... Args>
|
template <typename OutputIt, typename... Args>
|
||||||
inline void vformat_to(OutputIt out, string_view format_str,
|
inline OutputIt vformat_to(OutputIt out, string_view format_str,
|
||||||
format_args_t<OutputIt> args) {
|
format_args_t<OutputIt> args) {
|
||||||
using range = output_range<OutputIt, char>;
|
using range = output_range<OutputIt, char>;
|
||||||
do_vformat_to<arg_formatter<range>>(range(out), format_str, args);
|
return do_vformat_to<arg_formatter<range>>(range(out), format_str, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename OutputIt, typename... Args>
|
template <typename OutputIt, typename... Args>
|
||||||
inline void format_to(OutputIt out, string_view format_str,
|
inline OutputIt format_to(OutputIt out, string_view format_str,
|
||||||
const Args & ... args) {
|
const Args & ... args) {
|
||||||
vformat_to(out, format_str, *make_args<context_t<OutputIt>>(args...));
|
return vformat_to(out, format_str, *make_args<context_t<OutputIt>>(args...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Container, typename... Args>
|
template <typename Container, typename... Args>
|
||||||
|
Loading…
Reference in New Issue
Block a user