I have below structures.
typedef struct
{
uint32_t aa;
float32_t bb;
float32_t cc;
float32_t dd;
float32_t ee;
}struct_1;
typedef struct
{
uint32_t hh;
float32_t bb;
float32_t cc;
float32_t ii;
float32_t jj;
}struct_2;
I have created array of structures where struct_1 is dynamically allocated and struct_2 is static.
struct_1 *array1 = new struct_1[300];
struct_2 array2[300];
How to copy the contents efficiently from array2 to array1? I don't want to memcpy here because if in future types of any structure is changed then it will cause a problem.
Can i use std::transform or std::copy in this scenario? Please help me with the syntax.
typedef. In your case,struct struct_1 { // };will suffice.