I am trying to add some syntax sugar in my OpenGL code. I started with
GLint mapView, mapProjection, f1;
...
mapView = glGetUniformLocation( program, "mapView" );
mapProjection = glGetUniformLocation( program, "mapProjection" );
f1 = glGetUniformLocation( program, "f1" );
Converting this to a macro was easy enough
#define BindUniform(name) name = glGetUniformLocation( program, #name )
...
BindUniform( mapView );
BindUniform( mapProjection );
BindUniform( f1 );
Now I want to convert to a variadic macro
#define BindUniforms(...) ? foreach(x) x = glGetUniformLocation( program, #x) ?
...
BindUniforms( mapView, mapProjection, f1 );
Is it possible to achieve elegantly enough? I'm hoping for a 2-3 lines solution. I saw a 30+ lines huge macro set solution that builds on recursions but that looks like an overkill. Also note that the macro is writing to the argument, unlike some examples that I tried and can only read from it.
EDIT. I did some searching before posting this question. This question Is it possible to iterate over arguments in variadic macros? has a few solutions, but they are either too many lines of code or don't write to arguments. So, the idea behind my question is how to achieve it with as little code as possible.