mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-02 02:29:08 +00:00
Write docs.
This commit is contained in:
parent
da0293c4dd
commit
f9561671cf
@ -31,6 +31,8 @@ namespace is usually omitted in examples.
|
||||
|
||||
.. doxygenfunction:: fmt::print(std::FILE *, StringRef, const ArgList &)
|
||||
|
||||
.. doxygenfunction:: fmt::print(std::ostream &, StringRef, const ArgList &)
|
||||
|
||||
.. doxygendefine:: FMT_VARIADIC
|
||||
|
||||
.. doxygenclass:: fmt::BasicWriter
|
||||
|
12
format.h
12
format.h
@ -2004,6 +2004,18 @@ inline void format_decimal(char *&buffer, T value) {
|
||||
fmt::print(format, args);
|
||||
}
|
||||
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
|
||||
*/
|
||||
#define FMT_VARIADIC(ReturnType, func, ...) \
|
||||
|
@ -1545,3 +1545,12 @@ TEST(FormatTest, ArgConverter) {
|
||||
ArgConverter<fmt::LongLong>(arg, 'd').visit(arg);
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user