Commit 86716894 authored by Victor Zverovich's avatar Victor Zverovich

Update docs and formatting

parent cc10b460
...@@ -253,11 +253,10 @@ custom argument formatter class:: ...@@ -253,11 +253,10 @@ custom argument formatter class::
using arg_formatter::operator(); using arg_formatter::operator();
void operator()(int value) { auto operator()(int value) {
if (spec().type() == 'x') if (spec().type() == 'x')
(*this)(static_cast<unsigned>(value)); // convert to unsigned and format return (*this)(static_cast<unsigned>(value)); // convert to unsigned and format
else return arg_formatter::operator()(value);
arg_formatter::operator()(value);
} }
}; };
......
...@@ -2145,7 +2145,7 @@ FMT_CONSTEXPR void parse_format_string( ...@@ -2145,7 +2145,7 @@ FMT_CONSTEXPR void parse_format_string(
auto end = begin + format_str.size(); auto end = begin + format_str.size();
for (;;) { for (;;) {
// Doing two passes with memchr (one for '{' and another for '}') is up to // Doing two passes with memchr (one for '{' and another for '}') is up to
// 2.5x faster than the naive one-pass implementation on long format strings. // 2.5x faster than the naive one-pass implementation on big format strings.
const Char *p = FMT_NULL; const Char *p = FMT_NULL;
if (!find<IS_CONSTEXPR>(begin, end, '{', p)) { if (!find<IS_CONSTEXPR>(begin, end, '{', p)) {
if (begin != end) if (begin != end)
...@@ -2217,7 +2217,8 @@ class format_string_checker { ...@@ -2217,7 +2217,8 @@ class format_string_checker {
FMT_CONSTEXPR const Char *on_format_specs(iterator it) { FMT_CONSTEXPR const Char *on_format_specs(iterator it) {
auto p = pointer_from(it); auto p = pointer_from(it);
context_.advance_to(p); context_.advance_to(p);
return to_unsigned(arg_id_) < NUM_ARGS ? parse_funcs_[arg_id_](context_) : p; return to_unsigned(arg_id_) < NUM_ARGS ?
parse_funcs_[arg_id_](context_) : p;
} }
FMT_CONSTEXPR void on_error(const char *message) { FMT_CONSTEXPR void on_error(const char *message) {
...@@ -2747,7 +2748,8 @@ class basic_writer { ...@@ -2747,7 +2748,8 @@ class basic_writer {
} }
template <typename T> template <typename T>
typename std::enable_if<std::is_same<T, void>::value>::type write(const T* p) { typename std::enable_if<std::is_same<T, void>::value>::type
write(const T *p) {
format_specs specs; format_specs specs;
specs.flags_ = HASH_FLAG; specs.flags_ = HASH_FLAG;
specs.type_ = 'x'; specs.type_ = 'x';
...@@ -3525,8 +3527,8 @@ inline format_to_n_result<OutputIt> vformat_to_n( ...@@ -3525,8 +3527,8 @@ inline format_to_n_result<OutputIt> vformat_to_n(
/** /**
\rst \rst
Formats arguments, writes up to ``n`` characters of the result to the output Formats arguments, writes up to ``n`` characters of the result to the output
iterator ``out`` and returns the total output size and the iterator past the end iterator ``out`` and returns the total output size and the iterator past the
of the output range. end of the output range.
\endrst \endrst
*/ */
template <typename OutputIt, typename... Args> template <typename OutputIt, typename... Args>
...@@ -3537,7 +3539,8 @@ inline format_to_n_result<OutputIt> format_to_n( ...@@ -3537,7 +3539,8 @@ inline format_to_n_result<OutputIt> format_to_n(
} }
template <typename OutputIt, typename... Args> template <typename OutputIt, typename... Args>
inline format_to_n_result<OutputIt> format_to_n( inline format_to_n_result<OutputIt> format_to_n(
OutputIt out, std::size_t n, wstring_view format_str, const Args &... args) { OutputIt out, std::size_t n, wstring_view format_str,
const Args &... args) {
typedef internal::truncating_iterator<OutputIt> It; typedef internal::truncating_iterator<OutputIt> It;
auto it = vformat_to(It(out, n), format_str, auto it = vformat_to(It(out, n), format_str,
make_format_args<typename format_context_t<It, wchar_t>::type>(args...)); make_format_args<typename format_context_t<It, wchar_t>::type>(args...));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment