When to use * and & signs (call by reference, or value, …)
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/2139224/how-to-pass-objects-to-functions-in-c">How to pass objects to functions in C++?</a>  </p>
</blockquote>



<p>My main program gives me coefficient of plane equation as a vector. </p>

<p>I have many planes and I am trying to find out their intersections. So, I have series of plane parameters, belongs to each plane and I have created a map to accommodate plane parameters and I gave a key as plane number. Now, I am calling planes according to randomly given order (that is why, I use map). So, for each time I am using two planes to compare whether they intersect or not.</p>

<p>My function:</p>

<pre><code>vector&lt;double&gt; intersection_vector(vector&lt;double&gt; plane1,vector&lt;double&gt; plane2){
    vector&lt;double&gt; cross_product;
    double a1=plane1.at(0);
    double b1=plane1.at(1);
    double a2=plane2.at(0);
    double b2=plane2.at(1);
    //double d1=plane1.at(2);
    //double d2=plane2.at(2);
    int c1=-1,c2=-1;
    double cross_a=(b1*c2)-(b2*c1);
    double cross_b=(a2*c1)-(a1*c2);
    double cross_c=(a1*b2)-(a2*b1);
    cross_product.push_back(cross_a);cross_product.push_back(cross_b);cross_product.push_back(cross_c);
    return cross_product;
    }
</code></pre>

<p>Main program:</p>

<pre><code>//some codes

map&lt;int, vector&lt;int&gt; &gt;::iterator xx;
for (xx=parameter_list.begin();xx!= parameter _list.end();xx++){
       int my_plane=xx-&gt;first;
       vector &lt;int&gt; your_planes=xx-&gt;second;
       for(int i=0; i&lt; your _planes.size();i++){        
                   int any_ your _plane= your _planes.at(i);
        vector &lt;double&gt;edge_line=intersection_vector(my_plane, any_ your _plane);

       // do something
</code></pre>

<p>Now, I want to use pointers and references to speed up this process. Please help me while explaining why use <code>*</code> and <code>&amp;</code> for respective places. (Maybe I need call by reference or something else and what I did is call by value? Is that, plase explain because, I do not have basic on this).</p>
