mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-26 20:20:04 +00:00
Update readme
This commit is contained in:
parent
84e520b79c
commit
f61ca2ec4f
@ -127,18 +127,18 @@ An object of any user-defined type for which there is an overloaded
|
||||
You can create your own functions similar to `format
|
||||
<http://fmtlib.net/latest/api.html#format>`_ and
|
||||
`print <http://fmtlib.net/latest/api.html#print>`_
|
||||
which take arbitrary arguments:
|
||||
which take arbitrary arguments ([godbolt](https://godbolt.org/g/uoSRRh):
|
||||
|
||||
.. code:: c++
|
||||
|
||||
// Prints formatted error message.
|
||||
void vreport_error(const char *format, fmt::args args) {
|
||||
void vreport_error(const char *format, fmt::format_args args) {
|
||||
fmt::print("Error: ");
|
||||
fmt::vprint(format, args);
|
||||
}
|
||||
template <typename... Args>
|
||||
void report_error(const char *format, const Args & ... args) {
|
||||
vreport_error(format, fmt::make_args(args));
|
||||
vreport_error(format, fmt::make_args(args...));
|
||||
}
|
||||
|
||||
report_error("file not found: {}", path);
|
||||
|
Loading…
Reference in New Issue
Block a user