variadic Questions

3

Solved

In PostgreSQL 9.3.4 release note it says: Ensure that the planner sees equivalent VARIADIC and non-VARIADIC function calls as equivalent (Tom Lane) I searched the PostgreSQL manual and couldn't f...
Pantsuit asked 19/11, 2015 at 11:25

4

Solved

I was wondering if C++0x provides any built-in capabilities to check if a parameter pack of a variadic template contains a specific type. Today, boost:::mpl::contains can be used to accomplish this...
Underplot asked 22/1, 2010 at 16:4

1

Solved

Update: Edited to fix compilation in working example. I want to do something like the following so the function can take in both a list of the enum class instances or a struct that holds them, but ...
Brazenfaced asked 15/6, 2023 at 20:15

3

I have a question regarding restarting variadic argument lists (va_list). Basically I want to do something like this: void someFunc(char* fmt, ...) { va_list ap; va_start(fmt, ap); otherFuncA(f...
Medievalism asked 7/5, 2018 at 14:4

1

Solved

I am rewriting a python program into rust and I am struggling to translate this line: itertools.product(range(0,8), repeat=n) What I am trying to achieve is something like this: https://pastebin.co...
Antiworld asked 24/3, 2023 at 13:35

13

Solved

In C, is it possible to forward the invocation of a variadic function? As in, int my_printf(char *fmt, ...) { fprintf(stderr, "Calling printf with fmt %s", fmt); return SOMEHOW_INVOKE_LIBC_PRINT...
Disaffection asked 29/9, 2008 at 20:41

2

Solved

I was looking at "How to properly use references with variadic templates," and wondered how far comma expansion can go. Here's a variant of the answer: inline void inc() { } template<typename...
Zeal asked 19/4, 2012 at 10:21

3

Not a duplicate of What is std::invoke in c++?. That quesiton asks specifically about that one and only feature. This question asks about a concept which can be 100% solved withOUT that feature, an...
Vitelline asked 30/9, 2022 at 6:38

3

Solved

A variadic function and main() #include <stdio.h> #include <stdarg.h> int f(long x,...) { va_list ap; int i=0; va_start(ap,x); while(x) { i++; printf("%ld ", x); x=va_arg(ap,long...
Citric asked 13/4, 2018 at 11:13

2

Solved

I'm trying to compile a huge, world-renowned numerical weather prediction code - written mostly in Fortran 90 - that uses cpp extensively, and successfully, with PGI, Intel and gfortran. Now, I've ...
Tamas asked 26/12, 2016 at 19:15

2

Solved

I'm writing a simple game with Entity Component System. One of my components is NativeScriptComponent. It contains the instance of my script. The idea is that I can create my NativeScriptComponent ...
Oulu asked 11/8, 2022 at 11:32

10

Solved

I was wondering if it is possible to iterate over arguments passed to a variadic macro in C99 or using any GCC extensions ? For e.g. is it possible to write a generic macro that takes a structure ...
Andesine asked 9/12, 2009 at 7:35

3

Solved

I'm trying to create a function that can take multiple parameters of the same type, passed in as a template. The number of arguments is known in compile time: struct Foo { int a, b, c; }; templat...
Mell asked 16/6, 2022 at 14:12

4

Solved

I'm playing with the great fmt C++ library to format strings more gracefully. And I'd like to pass a non-variable arguments list to fmt::format. It could be a std::vector, or std::string, or whate...
Armin asked 19/2, 2018 at 23:2

6

Solved

I want to write a macro in C that accepts any number of parameters, not a specific number example: #define macro( X ) something_complicated( whatever( X ) ) where X is any number of parameters ...
Enunciation asked 25/3, 2009 at 2:8

2

Solved

I'm writing a promotion template alias similar to boost::promote but for C++11. The purpose of this is to avoid warnings when retrieving arguments from varidic functions. e.g. template <typenam...
Philippeville asked 23/3, 2013 at 11:21

11

Solved

I know this is a basic question, but I couldn't find an answer. Why use it? if you write a function or a method that's using it, when you remove it the code will still work perfectly, 100% as with...

4

Solved

I'm wondering why it's not possible to do the following in go: func main() { stuff := []string{"baz", "bla"} foo("bar", stuff...) } func foo(s ...string) { fmt.Println(s) } In my understandi...
Levite asked 20/2, 2015 at 9:26

7

Solved

I recently learned about the existence of template template parameters and was now wondering if something like this would be possible: template<template<class... > class Container, typena...
Laveen asked 9/3, 2014 at 23:48

3

Solved

void foo(std::string arg, ...) { // do something with every argument } Lets say I want to be able to take every string argument and append an exclamation mark before printing it out on a new l...
Gilly asked 20/12, 2016 at 7:32

2

Solved

I have inherited the following: template <typename T> concept IsAwaiter = requires { typename T::await_ready; typename T::await_suspend; typename T::await_resume; }; template <typename...
Privily asked 8/9, 2020 at 18:26

1

Solved

I am trying to write a class template that uses a parameter-pack and implements a member function for each type contained in the parameter-pack. This is what I have so far: template <typename......
Holbert asked 25/6, 2020 at 15:17

1

Solved

I have a standard logging API built into my C code, a nice simple logF(const char *pFormat, ...) thing which has always, so far, been mapped to vprintf(), i.e.: void logF(const char *pFormat, ...)...
Vocable asked 25/3, 2020 at 14:3

2

Solved

I need to write a variadic macro in C which must take zero or more arguments. In gcc, that can be achieved by adding "##" after the comma, e.g. ,##____VA_ARGS____ as answered in Variadic ...
Sidesman asked 9/12, 2011 at 11:18

4

Solved

One of the uses of ... is to denote variadic entities in C and C++. What is its name? Is it classified as an operator or something else when used that way? Any other details regarding ...? Edi...
Darwen asked 11/1, 2020 at 17:49

© 2022 - 2025 — McMap. All rights reserved.