Questions tagged [variadic]
In computer science, an operator or function is variadic if it can take a varying number of arguments; that is, if its arity is not fixed.
78 questions
2votes
1answer
184views
An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++
This is a follow-up question for Multi-dimensional Image Data Structure with Variadic Template Functions in C++. Considering the suggestion from G. Sliepen: Make everything work for more than 5 ...
5votes
1answer
322views
Multi-dimensional Image Data Structure with Variadic Template Functions in C++
This is a follow-up question for Three dimensional data structure in C++. I am trying to implement multi-dimensional image data structure with variadic template functions. For example, ...
2votes
2answers
387views
Logger using variadic macros
I'm getting back into C and I wrote this variadic logger as part of a chess application I'm writing. As such I'm looking for feedback about the general approach (I'm going to give it another pass to ...
4votes
2answers
216views
Transpose types variadicly
I want to do template metaprogramming to compute the conversion from std::variant<Ts...> to ...
4votes
1answer
2kviews
Template to unpack arguments to a std::function
I am writing some C++ code to interact with an external scripting language. I want to be able to register arbitrary C++ callable code as functions to be called from the script. The scripting library ...
1vote
2answers
67views
C++ variardic universal template for unknown types, used to handle multiple network protocols
I am creating a template function with variardic arguments, to handle a specific classes that have some interface, method, member or whatever is specialized in a specialization area. However I came to ...
2votes
1answer
494views
splitting a tuple into N-element tuples
This nice hack should allow you to split a tuple into N-element tuples, thereby effectively splitting a tuple into pairs, triples, ... For example, this allows you to split an input parameter pack, ...
5votes
3answers
133views
C function that emulates string concatenation operator '+' in Python or Go
I'm working on a project of mine which required multiple calls to strncat(), and it came to me that it'd have been much easier if C also had something like ...
1vote
1answer
98views
A Function Applier for Applying Various Algorithms on Nested Container Things in C++
This is a follow-up question for A recursive_replace_if Template Function Implementation in C++, A recursive_copy_if Template Function Implementation in C++, A recursive_count_if Function with Unwrap ...
5votes
1answer
500views
Using templates to wrap variardic JNI method calls into type-safe C++ functors
I am working on a project which uses JNI. More than once I fell over the absence of type safety working with the variardic function calls. So I came up with this module. It wraps the variardic JNI ...
5votes
1answer
191views
Meta functions for sequences of exponents of 2
I have implemented some meta functions to create sequence for exponents of 2. I would love to know if there is any way to make the code more optimized. Note: ...
1vote
1answer
313views
Using vswprintf( ... ) to create wchar_t* with variable argument list
I am using c++17 and wide characters. I have created a function to create a wchar_t* using a variable number of parameters ... #include <stdarg.h> // the ...
5votes
1answer
627views
`zip` operator to iterate on multiple container in a sign
I worked out a zip operator similar to Python's, because I didn't find one in std. It allows to use range-based ...
7votes
3answers
784views
Coalescing lvalue references to std-optionals
I want to coalesce (lvalue references to) optionals of the same type, in C++17: ...
10votes
2answers
9kviews
`printf` improvement with C++ variadic templates
I am currently working through learning C++'s variadic templates and I wanted to create an example use of them that is less trivial than the one in my book. I decided to create a modification of ...