title: error C2228: left of '.size' must have class/struct/union
body: <p>I'm getting this compiler error when calling vector's <code>size()</code>. Why? </p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;sstream&gt;
  #include &lt;string&gt;
  #include &lt;cassert&gt;
  
  
  using namespace std;
  
  class Vertex {
  
      float firstValue;
      float secondValue;
      float thirdValue;
  
      Vertex (float first, float second, float third){
            firstValue=first;
            secondValue=second;
            thirdValue=third;
      }
  
  };
  
  
  int main()
  {
      cout&lt;&lt;"This program loads a 3D .off object. \nEnter the name of the file that describes it "&lt;&lt;endl;
      string inputFileName;
      getline(cin, inputFileName);
  
      ifstream inputFileStream;
  
      inputFileStream.open(inputFileName.data());
      assert (inputFileStream.is_open());
  
      string actualLine;
  
      for(;;){
  
          inputFileStream&gt;&gt;actualLine;
  
          istringstream actualLineStream(actualLine);
  
  
  
          std::vector&lt;float&gt; results( std::istream_iterator&lt;int&gt;(actualLineStream)
                          , std::istream_iterator&lt;int&gt;() );
  
         int resultsIndex=0;
         int resultsSize=results.size(); //WHY??
  
         while (resultsIndex&lt;resultsSize){
  
           cout&lt;&lt;results[resultsIndex]&lt;&lt;endl;
         }
  
  
          if (inputFileStream.eof()) break;
  
      }
  
  
      ofstream outputChannel;
  
      while (true){} // to keep on console view 
      return 0;
  }
  </code></pre>