Open mpiku opened 3 years ago
I guess Particles
will be copy-constructed in Swarm::makeSwarm
. Since we have default constructor and the object is not heavy weight yet it shouldn't be a problem.
We might consider changing vector
in Swarm
to vector<Particle*> swarm
in future.
Initialization of
vector <Particle> swarm
in the constructor initialization list might result in inefficient construction ofParticle
objects in thevector
. I am not sure, but it results in reallocating vector memory later or constructing particle objects twice.https://github.com/egi-megi/rojCzastek_Szczepanski_Jurkiewicz_Pikulinski/blob/3a730fc57c51f2a00332cec6067e04f5e872b4b5/src/Swarm.cpp#L18-L19
https://github.com/egi-megi/rojCzastek_Szczepanski_Jurkiewicz_Pikulinski/blob/3a730fc57c51f2a00332cec6067e04f5e872b4b5/src/Swarm.cpp#L26-L27