I need your help:
My questions are related to my program can be as fast as possible.

I have :
1.- I create n instances of class1.
2.- vector to save this instances :
First question what is better to save pointers or reference - copies ?

3.- I want to pass this vector to a function of class2
Second question what is better to pass pointer to vector or reference.

4.- In this new function I'm going to create a vector of a new class
vector<class3> and I know the exact number of elements I have to create for this vector.

5.- I'm going to pass the instances of class1 that I've received to this vector, trought a method. So I have for class3 a method called set_class1.
Third question what is better to pass to this set_class1 pointer or reference, taking into account that I have received the class1 objects using a vector.

The code I have now : (pseudocode )


Code in main:

Qt Code:
  1. vector<My_class1> * v_my_class1 = new vector<My_class1>;
  2. for (int i=0;i<limit;i++)
  3. {My_class1 a_class1 = new My_class1;
  4. v_my_class1->push_back(*a_class1);}
  5.  
  6. My_class2(v_my_class1) ;
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. My_class2(vector<My_class1> * a_vector_of_class1)
  2.  
  3. vector<class3> v_vector_class3 ;
  4. for (int i=0;i<a_vector_of_class1->size();i++)
  5. { v_vector_class3.push_back (*(new class3));
  6. v_vector_class3[i].set_class1(&a_vector_of_class1->at(i) }
To copy to clipboard, switch view to plain text mode 

( a_vector_of_class1->at(i) compile a_vector_of_class1[i] not ... ???)


Any advise ? Thanks