All Questions
Tagged with variadic-macros c++20
6 questions
0
votes
1
answer
546
views
Stringify each token in __VA_ARGS__ from a variadic macro [duplicate]
I am trying to #stringify each token in a __VA_ARGS__ from a variadic macro.
The idea is to use these tokens as entries in an enum and also push them (stringified) to a std::vector<std::string>. ...
3
votes
1
answer
560
views
Getting __VA_OPT__ to be recognized by Visual Studio?
Tried to set /std:c++20 or /std:c++latest along /Zc:preprocessor as mentioned in the documentation but Visual Studio refuses to recognize __VA_OPT__ in the following snippet:
#define _sdk_log(fmt, ...)...
2
votes
2
answers
78
views
Variadic macros to create multiple constructs with delimiters
EDIT2: Figured it out. See my answer below.
Some background:
I am using an SQL library that returns query results as tuples. For each DB statement I write:
An SQL query that includes a list of ...
1
vote
1
answer
931
views
How to expand a recursive macro via __VA_OPT__ in a nested context
I have read this article, which illustrates how the __VA_OPT__ function macro can be used to recursively expand a macro. I would like to implement something similar, with the difference being that the ...
0
votes
1
answer
78
views
C++20: generate type from given variadic types
Lets say, I have a variadic type list which can grow
e.g.
#define MY_TYPES void, float, int, vector<long>, .....
I am looking for way to generate these type definition at compile time in c++...
0
votes
1
answer
161
views
trick or new method to expend PPNARG macro
I asked a question:
c++ macro expansion(__VA_ARGS__ item name and value)
#include <iostream>
#include <memory>
#include <vector>
#include <functional>
#define PP_NARG(...) ...