Initializing struct incompletely

Hello,

is the following correct?

Suppose I define a structure:
1
2
3
4
5
  struct particle_neighborlist{
    double x, y, z, disp_x, disp_y, disp_z;
    std::vector <std::size_t> neighborlist;

};


And then I initialize a struct of this type with
1
2
3
4
5
//suppose double x,y,z are initialized   
 vector <particle_neighborlist> system; 
   
 system.push_back({x,y,z,0,0,0});
    


This would give me a vector system with a single component. This component is a structure of the type of above. The x,y,z variables from the structure are set according to the x,y,z in my system.push_back({x,y,z,0,0,0}); command, the disp_x, disp_y, disp_z in the structure are set to 0 and the vector neighborlist is declared but not initialized, meaning it has size 0.

Is this correct?

Regards.
Last edited on
Yes.
Thank you!
Topic archived. No new replies allowed.