title: Passing Vector of Struct to Function
body: <p>I'm struggling to figure out how to pass a Vector of a Struct to a function in an easy and elegant way. The code looks like this:</p>
  
  <pre><code>struct cube{ double width; double length; double height; };
  vector&lt;cube&gt; myVec;
  int myFunc(vector&lt;double&gt; &amp;in)
  {
  // do something here
  }
  int test = myFunc(myVec.width); // NOT POSSIBLE
  </code></pre>
  
  <p>So what I want is to pass just the vector of widths to the function and perform some calculations. Is this at all possible or do I have to pass the complete vector fo struct to the function myFunc()?</p>