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.

learn more… | top users | synonyms

6
votes
3answers
365 views

Sample printf implementation

Here is my code for printf() implementation in C. Please share your thoughts for improvements. ...
1
vote
0answers
29 views

Creating class method using macro to accept Visitator for each of their fields

I had a lot of classes that used a macro with listed fields. The macro was used to serialization, more like MSGPACK_DEFINE. I need a substitution of this mechanism, ...
5
votes
1answer
76 views

Thread-Safe Variadic Printing Function

Printing to stdout is thread-safe in many systems when using printf or std::cout, but not in ...
4
votes
0answers
105 views

Optimizing variadic template pack subsequence matching algorithm

I'm building a small MPL module in one of my utility libraries for fun and learning experience. One of the problems I'm trying to solve is getting a list of all indices where a sequence of types ...
3
votes
1answer
160 views

Selecting variable amount of vector elements in C++

Suppose we are given a C++ vector. We want to specify a variable amount of indices and select elements from a vector being indexed. I have two implementation: (A) one relies on C++11 initializer ...
7
votes
0answers
106 views

Macro to build type declaration

These are some macros to help build a traits class (for the parser/printer classes I am building). Traits.h ...
3
votes
0answers
75 views

Generating all permutations of a template pack

AllPermutedPacks<Pack<Types...>>::type is to be the pack of packs consisting of all permutations of Types.... For ...
6
votes
1answer
99 views

Variadic template for concisely defining a tuple whose components are all the same type

C++11 provides a std::tuple template, but it requires the types of all the fields to be listed individually, which is inconvenient if there are many fields and ...
4
votes
1answer
314 views

Simple mathematical operations (add, sub, mul, div) in C++11 template

I made a simple script to implement basic mathematics operations by using variadic functions. I would like to know if my implementation is correct. The code only works for Visual C++ compiler Nov ...
7
votes
2answers
354 views

writeln() and format() with variadic templates

I wanted to get better acquainted with variadic templates, so I decide to try to implement a function like D's writeln(), just for fun. ...
5
votes
1answer
210 views

Test whether a type T is among the types of a tuple

On SO, I asked for a way to do it without variadics. I also provided a typical "normal" implementation with variadics: ...
4
votes
2answers
1k views

Bit packing and unpacking

I needed a variadic function to pack and unpack bits into integer types. This is my first attempt: ...
11
votes
3answers
2k views

Very basic tuple implementation

I've been messing with metaprogramming and variadic templates in C++, and I came up with this very primitive implementation of a tuple: ...
7
votes
1answer
270 views

Most elegant variadic functor

Question Suppose we have two sorts of classes an input class Input defines a type result_type defines ...
4
votes
1answer
568 views

Event handler using variadic templates

I am currently working on a game and found myself in need of an event handler. I wrote an event handler similar to this one some time ago, but decided to update it using variadic templates (this is ...
7
votes
1answer
3k views

A small printf-like function using variadic templates

I'm looking to get some feedback on a small printf-like function I wrote that provides simplified behavior similar to ...
1
vote
1answer
232 views

C-style va_args replacement

I inherited a lot of C code with many ellipsis (variadic) functions. I have a lots of API with the following signature: ...
11
votes
1answer
649 views

Variadic function with restricted types

I am designing a class which (among other things) acts as a vertex in an undirected graph. ...