I have the following lines in my code:
#define NUM_THREADS 8 // NUM_THREADS is variable
myClass myVar[NUM_THREADS] {{&A,&x}};
A and x are just variables that are used in the myClass constructor to setup the size of some variables of the myVar objects. However, the values of A and x aren't known until run time.
Since NUM_THREADS is variable, what I want is for every object (i.e. myVar[NUM_THREADS-1:0] to get the same values sent in for the constructor, without having to manually type out the following.:
myClass myVar[NUM_THREADS] {{&A,&x},{&A,&x},{&A,&x},{&A,&x},{&A,&x},{&A,&x},{&A,&x},{&A,&x}};
Here's what the constructor looks like:
myClass::myClass(Aclass *A_orig, Xclass *x_orig) {
A_new = *A_orig;
x_new = *x_orig;
}
std::initializer_list. I have to think a moment about how such could look like. Or maybe somebody else more versed in template meta-programming will give you an example.