Commit f9561671 authored by Victor Zverovich's avatar Victor Zverovich

Write docs.

parent da0293c4
...@@ -31,6 +31,8 @@ namespace is usually omitted in examples. ...@@ -31,6 +31,8 @@ namespace is usually omitted in examples.
.. doxygenfunction:: fmt::print(std::FILE *, StringRef, const ArgList &) .. doxygenfunction:: fmt::print(std::FILE *, StringRef, const ArgList &)
.. doxygenfunction:: fmt::print(std::ostream &, StringRef, const ArgList &)
.. doxygendefine:: FMT_VARIADIC .. doxygendefine:: FMT_VARIADIC
.. doxygenclass:: fmt::BasicWriter .. doxygenclass:: fmt::BasicWriter
......
...@@ -2004,6 +2004,18 @@ inline void format_decimal(char *&buffer, T value) { ...@@ -2004,6 +2004,18 @@ inline void format_decimal(char *&buffer, T value) {
fmt::print(format, args); fmt::print(format, args);
} }
FMT_VARIADIC(void, print_error, const char *, int, const char *) FMT_VARIADIC(void, print_error, const char *, int, const char *)
``FMT_VARIADIC`` is used for compatibility with legacy C++ compilers that
don't implement variadic templates. You don't have to use this macro if
you don't need legacy compiler support and can use variadic templates
directly::
template<typename... Args>
void print_error(const char *file, int line, const char *format,
const Args & ... args) {
fmt::print("{}: {}: ", file, line);
fmt::print(format, args...);
}
\endrst \endrst
*/ */
#define FMT_VARIADIC(ReturnType, func, ...) \ #define FMT_VARIADIC(ReturnType, func, ...) \
......
...@@ -1545,3 +1545,12 @@ TEST(FormatTest, ArgConverter) { ...@@ -1545,3 +1545,12 @@ TEST(FormatTest, ArgConverter) {
ArgConverter<fmt::LongLong>(arg, 'd').visit(arg); ArgConverter<fmt::LongLong>(arg, 'd').visit(arg);
EXPECT_EQ(Arg::LONG_LONG, arg.type); EXPECT_EQ(Arg::LONG_LONG, arg.type);
} }
#if FMT_USE_VARIADIC_TEMPLATES
template<typename... Args>
void print_error(const char *file, int line, const char *format,
const Args & ... args) {
fmt::print("{}: {}: ", file, line);
fmt::print(format, args...);
}
#endif
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