title: Using pointers to simplify my code in C++
body: <p>Here's my code:</p>
  
  <pre><code>    void spin(double angle) {
  
      // Convert degrees to radians
      angle = get_radians(angle);
  
      vector&lt;complex&lt;double&gt;&gt; coordinate_list;
      coordinate_list.push_back(co1);
      coordinate_list.push_back(co2);
      coordinate_list.push_back(co3);
      coordinate_list.push_back(co4);
  
      // Origin point
      complex&lt;double&gt; origin(0,0);
  
      for (int i = 0; i &lt; coordinate_list.size(); ++i)
      {
          complex&lt;double&gt; current = coordinate_list[i];
          double x = current.real();
          double y = current.imag();
  
          // Assuming all rectangles origins are at (0,0)
          float temp_x = origin.real() - x;
          float temp_y = origin.imag() - y;
  
          x = round(temp_x * cos(angle) - temp_y * sin(angle));
          y = round(temp_x * sin(angle) + temp_y * cos(angle));
  
          complex&lt;double&gt; rotated(x,y);
          coordinate_list[i] = rotated;
      }
  
      co1 = coordinate_list[0];
      co2 = coordinate_list[1];
      co3 = coordinate_list[2];
      co4 = coordinate_list[3];
      }
  </code></pre>
  
  <p>I'm looking for a way to avoid the part after the loop. I have the co1-4 values already and this method can be called at any point to rotate coordinates. I'd rather access these values directly instead of sticking them in a list, changing them, then assigning them back.</p>
  
  <p>Is there a way to do this?</p>