All Questions
Tagged with variadic-macros templates
6 questions
1
vote
1
answer
75
views
Pass undefined number of template classes (having commas) as macro argument
TL;DR
What are the available tricks to pass undefined number of template classes to a macro in C++17 ? Example: my_macro(std::map<std::string,std::vector<double>>, double, std::deque<...
0
votes
0
answers
58
views
Is it possible to overload macros that contain VA_ARGS for logs?
I try overload WriteLogs macro with 1 and 2 params:
template <typename... Args>
void WriteLog(const LogContext& logContext, const LogSettings& logSettings, std::string formatMsg, Args... ...
4
votes
2
answers
1k
views
Counting function arguments at compile time
I'm trying to count the number of arguments to a function at compile time (I'm wrapping sprintf up in some templates for compile time checks and type safety). I need to check that the number of ...
-2
votes
1
answer
53
views
Function Definition Generation from Declaration using Template Metapogramming
C++ gurus,
I have a template metaprogramming question. Consider the following
function declaration.
int foo(const int x[], char *y, size_t size);
I would like to be able to generate the function ...
3
votes
2
answers
177
views
Testing member function, by peeling pairs off variadic macro/template/function?
(I'm using catch for unit testing, which unfortunately doesn't yet have what it's calling generators to do this sort of thing.)
In c++17, is there a way to reduce this:
assert("" == String{"" }....
2
votes
1
answer
89
views
Variadic template wrapping function call
I need a macro/templated function that will wrap function call of some method on specific object, i.e
a.Destroy()
where a can be of any type as well as Destroy and Destroy may or may not take 0 to n ...