Update docs
This commit is contained in:
parent
729a44e67d
commit
c0c4d1adab
16
doc/api.rst
16
doc/api.rst
@ -37,10 +37,14 @@ similar to that of Python's `str.format
|
|||||||
<https://docs.python.org/3/library/stdtypes.html#str.format>`_.
|
<https://docs.python.org/3/library/stdtypes.html#str.format>`_.
|
||||||
They take *fmt* and *args* as arguments.
|
They take *fmt* and *args* as arguments.
|
||||||
|
|
||||||
*fmt* is a format string that contains literal text and replacement
|
*fmt* is a format string that contains literal text and replacement fields
|
||||||
fields surrounded by braces ``{}``. The fields are replaced with formatted
|
surrounded by braces ``{}``. The fields are replaced with formatted arguments
|
||||||
arguments in the resulting string. A function taking *fmt* doesn't
|
in the resulting string. A function taking *fmt* doesn't participate in an
|
||||||
participate in an overload resolution if the latter is not a string.
|
overload resolution if the latter is not a string.
|
||||||
|
|
||||||
|
Most formatting functions such as ``fmt::format`` require a format string to
|
||||||
|
be known at compile time, i.e. be a string literal or a ``constexpr`` string.
|
||||||
|
To pass a runtime format string wrap it in ``fmt::runtime``.
|
||||||
|
|
||||||
*args* is an argument list representing objects to be formatted.
|
*args* is an argument list representing objects to be formatted.
|
||||||
|
|
||||||
@ -50,7 +54,7 @@ participate in an overload resolution if the latter is not a string.
|
|||||||
.. doxygenfunction:: vformat(string_view fmt, format_args args) -> std::string
|
.. doxygenfunction:: vformat(string_view fmt, format_args args) -> std::string
|
||||||
|
|
||||||
.. doxygenfunction:: format_to(OutputIt out, format_string<T...> fmt, T&&... args) -> OutputIt
|
.. doxygenfunction:: format_to(OutputIt out, format_string<T...> fmt, T&&... args) -> OutputIt
|
||||||
.. doxygenfunction:: format_to_n(OutputIt out, size_t n, format_string<T...> fmt, const T&... args) -> format_to_n_result<OutputIt>
|
.. doxygenfunction:: format_to_n(OutputIt out, size_t n, format_string<T...> fmt, T&&... args) -> format_to_n_result<OutputIt>
|
||||||
.. doxygenfunction:: formatted_size(format_string<T...> fmt, T&&... args) -> size_t
|
.. doxygenfunction:: formatted_size(format_string<T...> fmt, T&&... args) -> size_t
|
||||||
|
|
||||||
.. doxygenstruct:: fmt::format_to_n_result
|
.. doxygenstruct:: fmt::format_to_n_result
|
||||||
@ -78,6 +82,8 @@ To force the use of compile-time checks, define the preprocessor variable
|
|||||||
will fail to compile with regular strings. Runtime-checked
|
will fail to compile with regular strings. Runtime-checked
|
||||||
formatting is still possible using ``fmt::vformat``, ``fmt::vprint``, etc.
|
formatting is still possible using ``fmt::vformat``, ``fmt::vprint``, etc.
|
||||||
|
|
||||||
|
.. doxygenclass:: fmt::format_string
|
||||||
|
|
||||||
Named Arguments
|
Named Arguments
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user