Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
f9561671
Commit
f9561671
authored
Aug 21, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write docs.
parent
da0293c4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
doc/index.rst
doc/index.rst
+2
-0
format.h
format.h
+12
-0
test/format-test.cc
test/format-test.cc
+9
-0
No files found.
doc/index.rst
View file @
f9561671
...
...
@@ -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
...
...
format.h
View file @
f9561671
...
...
@@ -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, ...) \
...
...
test/format-test.cc
View file @
f9561671
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment