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.
Questions tagged [variadic]
668 questions
0
votes
2 answers
Variadic function fails in VC2010 and crashes in gcc
Question:
I have problems with my variadic function dbPRINT. It fails in VS2010 and crashes on GCC 4.8.1
The normal printf prints the exe's filename as I wish, but my dbPRINT function does not. I guess it has something to do with my variadic…

gerdb
- 11
- 2
0
votes
0 answers
Visual Studio static libraries and variadic template classes
I have just made the experience that variadic classes dont seem to work too well when compiling a static library in Visual Studio?
I have someting like this:
template
class A {...};
class B : public A {...};
The linker…

user2276094
- 399
- 1
- 4
- 11
0
votes
1 answer
GCC: __attribute__ ((format (printf, x, y)) does not seem to work when function is called using a variadic macro
GCC version ntoarm-gcc (GCC) 4.4.2
I've added 'printf' format attributes to all my functions that wrap printf() and co. They work perfectly fine except when calling the functions using a variadic macro.
class Log { [...]
void log_fmt(LogLevel…

unbekannt
- 23
- 1
- 4
0
votes
2 answers
Variadic templates construct template list
In the following code, how to use the list b, to create object_b in the same way that the list a was used to create object_a manually?
#include
-
template

prestokeys
- 4,817
- 3
- 20
- 43
0
votes
1 answer
sizeof in variadic template c++
I need to know how many items in parameter pack of a variadic templete.
my code:
#include
using namespace std;
template
struct StaticArray
{
int size = sizeof... (Entries);// line A
//int array[size] =…

cppython
- 1,209
- 3
- 20
- 30
0
votes
1 answer
gcc 4.7.2 error variadic template
I was trying to write a class that could act as a compile-time array, using some TMP and constexpr C++11 magic. The end-goal I was trying to achieve is basically being able to write
Type array[Size] = {X, X, X, ..., X};
as
Array…

JorenHeit
- 3,877
- 2
- 22
- 28
0
votes
1 answer
How to execute text made using sprintf as code in MATLAB?
I have some code that does a bunch of fourier transforms on a phone number. Right now I'm cutting the phone number into blocks, but I want it to work for any number of blocks.
The following code is what I want MATLAB to execute, but sprintf only…

user3129326
- 13
- 2
0
votes
2 answers
C++ variadic templates - NULL converts into int
I'm new to variadic templates in C++, so this question may seem kind of noobish to the experienced guys over here.
What im trying to do is create a proxy function that will be able to redirect my arguments to any other function using variadic…

CodeNinja
- 291
- 5
- 19
0
votes
1 answer
Visual Studio 2012 : no variadic templates : a solution?
I have a class that needs to support a dynamic set of type arguments, but VS2012 does not support variadic templates. (VS2013 and the compiler CTP do support variadic templates, but I can't use them. Nor can I use Boost.)
So, I'm trying to find a…

Spectral
- 717
- 2
- 12
- 28
0
votes
1 answer
Convert an array into function parameters
I register functions at a global registry. A function can have multiple arguments. I can register and call them from the registry.
Here is one of my unit tests to understand the registry.
void *a_test_function_d(int a, char *b){
printf("***…

Peter Shaw
- 1,867
- 1
- 19
- 32
0
votes
1 answer
How to pass template function to another function
I have below template function, and now I want to add a function testfun whose parameter will be each template function and its parameters. but I do not know how to define and implement testfun. Any comments is appreciated. Thanks!
template

Jerry YY Rain
- 4,134
- 7
- 35
- 52
0
votes
1 answer
How to pass a variable number of arguments of varying types to functions in a C++11 function map?
I am attempting to learn C++11 and have started writing a program that reads a textfile into a vector of strings, then passes the vector to a function that will ask the user to select the name of the function they wish to apply to the vector.
I…

erm
- 11
- 2
0
votes
2 answers
Create Functions that takes variable amount of parameters and data types
I know this question might be a little weird but the creators of C++ made it so that whenever we create a function in C++ we can specify what we want our parameters to be for example we can create a function like this:
void function(int test);
As…

CodingMadeEasy
- 2,257
- 4
- 19
- 31
0
votes
1 answer
Why does this code with TCHAR and variadic arguments behave this way?
I have the following helper function:
inline void DebugMessage(const TCHAR* fmtstr, ...)
{
va_list args;
va_start(args, fmtstr);
TCHAR buffer[256];
StringCbVPrintf(buffer, 256, fmtstr, args);
…

samoz
- 56,849
- 55
- 141
- 195
0
votes
1 answer
Create Custom Variadic Logging Function
I am in Objective-C trying to create a custom Variadic logging function, specifically I would like to "rebuild" string formats like what you send to NSLog. I have tried to understand Variadic functions but the language used to describe the different…

Matthew Kelling
- 37
- 5