The Problem:
I've been searching on here for a while looking for a way to loop through variables named somewhat like variable_1
, variable_2
, ...., variable_n
. Basically, I'm asking if there's a way to do that using a loop to achieve variable_i
or, more specifically in my case, functionName_i
.
What I need: I'm trying to loop an objects' array to call different functions which are sequentially-named and parallel to the objects' array ( i.e: obj[ i ]->callback_i( ) )
What I Know: Obviously, the answer here (if it were just variables) is using an array or vector. However, I need to just concatenate the functions' names sequentially somehow if it's possible.
Possible Workarounds: Everything I think of goes back to creating an array/vector of function pointers. I might get it eventually to work if I'm really out of options, but I just thought I should ask out of curiosity.
Clear Question: Is there a way to loop through sequentially-named functions using a variable int i
as part of the functions' names?
Thanks!