I am trying to initialize an array of struct in C++.
This is my struct:
typedef ap_fixed<16,1> ap_fixed_data_type;
typedef struct {
ap_fixed_data_type real_part;
ap_fixed_data_type imaginary_part;
} my_data_struct;
And this is my array of structs:
static my_data_struct IFFT_output[1024];
I would like to initialize my array of struct using (if possible) the same "syntax" of standard arrays, as an example:
int my_array[1024] = {0};
This will initialize my array to all 0.
What I am trying to achieve is something like:
static my_data_struct IFFT_output[1024]={{0,0}};
Where this code should initialize each field (real_part and imaginary_part) in each struct to 0.
With the above code I get this error:
terminate called after throwing an instance of '__gnu_cxx::recursive_init_error'
Which seems to be caused by bad initialized static variable (like here).
I know that I could initialize my data with a simple for loop, but I wanted to do something more "compact".
Is there a way to initialize my array of struct with the "syntax" I showed above?