Is it possible to declare variables within structures as follows:
typedef struct my_struct_1 {
thrust::host_vector h_var(2);
} MYSTRUCT_1
and then be able to access them?
I defined this structure in a header file.
In my source code, I did the following:
MYSTRUCT_1 *sgc = new MYSTRUCT_1;
memset(sgc, 0, sizeof MYSTRUCT_1);
sgc->h_var[0] = 14.0;
sgc->h_var[1] = 24.0;
When I define h_var as shown above and then compile, I get the following error related to my header file at the line where I made the ‘thrust::’ specification:
error: expected identifier before numeric constant
error: expected ‘,’ or ‘…’ before numeric constant
In the source code where I assign a value of 14.0 to h_var[0] and 24.0 to h_var[1] I get this error for both assignments:
error: invalid types ‘< unresolved overloaded function type >[int]’ for array subscript
If I replace the 'thrust::host_vector declaration above with just ‘float h_var[2]’, I have no problems compiling and executing.
Have I made an error along the way somewhere, or can I even utilize the thrust capabilities within a C++ structure?