diff --git a/doc/api.rst b/doc/api.rst index 4c18268c..c1a8bbdc 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -20,7 +20,7 @@ They take *format_str* and *args* as arguments. fields surrounded by braces ``{}``. The fields are replaced with formatted arguments in the resulting string. -*args* is an argument list representing arbitrary arguments. +*args* is an argument list representing objects to be formatted. The `performance of the format API `_ is close @@ -29,18 +29,15 @@ For even better speed use the `write API`_. .. _format: -.. doxygenfunction:: format(CStringRef, ArgList) +.. doxygenfunction:: format(string_view, const Args&...) .. doxygenfunction:: operator""_format(const char *, std::size_t) .. _print: -.. doxygenfunction:: print(CStringRef, ArgList) +.. doxygenfunction:: print(string_view, const Args&...) -.. doxygenfunction:: print(std::FILE *, CStringRef, ArgList) - -.. doxygenclass:: fmt::BasicFormatter - :members: +.. doxygenfunction:: print(std::FILE *, string_view, const Args&...) Date and time formatting ------------------------ @@ -116,7 +113,7 @@ formatting of user-defined types that have overloaded ``operator<<``:: std::string s = fmt::format("The date is {}", Date(2012, 12, 9)); // s == "The date is 2012-12-9" -.. doxygenfunction:: print(std::ostream&, CStringRef, ArgList) +.. doxygenfunction:: print(std::ostream&, string_view, ArgList) Argument formatters ------------------- @@ -171,13 +168,13 @@ the POSIX extension for positional arguments. Unlike their standard counterparts, the ``fmt`` functions are type-safe and throw an exception if an argument type doesn't match its format specification. -.. doxygenfunction:: printf(CStringRef, ArgList) +.. doxygenfunction:: printf(string_view, ArgList) -.. doxygenfunction:: fprintf(std::FILE *, CStringRef, ArgList) +.. doxygenfunction:: fprintf(std::FILE *, string_view, ArgList) -.. doxygenfunction:: fprintf(std::ostream&, CStringRef, ArgList) +.. doxygenfunction:: fprintf(std::ostream&, string_view, ArgList) -.. doxygenfunction:: sprintf(CStringRef, ArgList) +.. doxygenfunction:: sprintf(string_view, ArgList) .. doxygenclass:: fmt::PrintfFormatter :members: diff --git a/include/fmt/core.h b/include/fmt/core.h index 0079b598..95d8aac4 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -720,8 +720,8 @@ class arg_map { basic_arg arg; }; - entry *map_ = nullptr; - unsigned size_ = 0; + entry *map_; + unsigned size_; void push_back(value val) { const internal::named_arg_base &named = val.as_named_arg(); @@ -730,7 +730,7 @@ class arg_map { } public: - arg_map() {} + arg_map() : map_(FMT_NULL), size_(0) {} void init(const basic_format_args &args); ~arg_map() { delete [] map_; } @@ -791,7 +791,7 @@ class context_base { void on_error(const char *message) { parse_context_.on_error(message); } // Returns an iterator to the beginning of the output range. - auto begin() { return out_; } + iterator begin() { return out_; } // Advances the begin iterator to ``it``. void advance_to(iterator it) { out_ = it; }