Variatic functions and Structures

I am attempting to pass a variable amount of arrays consisting of variable amount of structures to a class constructor. I am confused on two points.
1. Can I somehow determine the size of the array (s) without having them passed as a parameter?
2. How do I reference the array of structs to assign it to array3[][]?

The code below attampts to explain what I am trying to do... I know it contains errors but i think you can get the jist of what I am trying, rather unsucsesfully, to do:

struct x{double a, double b};

main{
x array1[AnyAmount < MAX];
x array2[AnyAmount< MAX];

myclass obj(3,array1,array2);
}

myclass class{
public:
int q;
x array3[CONST][CONST];
myclass(int,...);
};
myclass::myclass(int num, ...){

va_list list;
va_start(list,num);
x *array_of_struct;

q = num;
for(int x = 0; x <= q; x++){
array_of_struct = &va_arg(list,x);
int indecee_count = sizeof(&array_of_struct )/sizeof(Dwell_Struc);
for(int y = 0; y < indecee_count ; y++){
array3[x][y] = array_of_struc[y];
}
}
va_end(list);
}

Thanks for helping the Hardware guy do Software!
[1289 byte] By [Emull] at [2007-11-20 11:02:05]
# 1 Re: Variatic functions and Structures
I am attempting to pass a variable amount of arrays consisting of variable amount of structures to a class constructor.A programmer resorting to using variadic functions in a C++ program is very rare. I'm sure there are better ways of doing what you want to do.
1. Can I somehow determine the size of the array (s) without having them passed as a parameter?No. Once you pass an array, you've lost this information.

1) Use vectors instead of arrays for your data.

2) Instead of variadic functions use a vector to hold all of your parameters. Then pass only this vector. Then you don't need variadic functions.

Regards,

Paul McKenzie
Paul McKenzie at 2007-11-9 1:24:59 >