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
2f752abe
Commit
2f752abe
authored
Jun 24, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add FMT_VARIADIC_VOID to emulate variadic functions on old compilers.
parent
8198df84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
format.h
format.h
+32
-0
No files found.
format.h
View file @
2f752abe
...
...
@@ -864,6 +864,35 @@ public:
}
};
// Generates a comma-separated list by applying f to numbers 1..n.
#define FMT_GEN(n, f) FMT_GEN##n(f)
#define FMT_GEN1(f) f(1)
#define FMT_GEN2(f) FMT_GEN1(f), f(2)
#define FMT_GEN3(f) FMT_GEN2(f), f(3)
#define FMT_GEN4(f) FMT_GEN3(f), f(4)
#define FMT_GEN5(f) FMT_GEN4(f), f(5)
#define FMT_GEN6(f) FMT_GEN5(f), f(6)
#define FMT_GEN7(f) FMT_GEN6(f), f(7)
#define FMT_GEN8(f) FMT_GEN7(f), f(8)
#define FMT_GEN9(f) FMT_GEN8(f), f(9)
#define FMT_MAKE_TEMPLATE_ARG(n) typename T##n
#define FMT_MAKE_ARG(n) const T##n &v##n
#define FMT_MAKE_REF(n) MakeArg(v##n)
#define FMT_TEMPLATE(func_name, n) \
template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> \
inline void func_name(BasicStringRef<Char> format, FMT_GEN(n, FMT_MAKE_ARG)) { \
const fmt::internal::ArgInfo args[] = {FMT_GEN(n, FMT_MAKE_REF)}; \
func_name(format, fmt::ArgList(args, sizeof(args) / sizeof(*args))); \
}
// Defines a variadic function returning void.
#define FMT_VARIADIC_VOID(func_name) \
FMT_TEMPLATE(format, 1) FMT_TEMPLATE(format, 2) FMT_TEMPLATE(format, 3) \
FMT_TEMPLATE(format, 4) FMT_TEMPLATE(format, 5) FMT_TEMPLATE(format, 6) \
FMT_TEMPLATE(format, 7) FMT_TEMPLATE(format, 8) FMT_TEMPLATE(format, 9)
/**
\rst
This template provides operations for formatting and writing data into
...
...
@@ -1249,6 +1278,9 @@ class BasicWriter {
BasicArg
<>
arg_array
[
internal
::
NonZero
<
sizeof
...(
Args
)
>::
VALUE
]
=
{
args
...};
this
->
printf
(
format
,
ArgList
(
arg_array
,
sizeof
...(
Args
)));
}
#else
FMT_VARIADIC_VOID
(
format
)
#endif
template
<
typename
T
>
...
...
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