title: Vector. How to set the maximum number of elements and find the current count?
body: <p>I want to create a vector with a maximum number of elements 48, and I want to know at any time the current number of elements in the vector.</p>
  
  <p>I use this code:</p>
  
  <p><strong>.h</strong></p>
  
  <pre><code>std::vector&lt; CPPobject* &gt;vec; 
  </code></pre>
  
  <p><strong>.mm</strong></p>
  
  <pre><code>int maxCountElementInVec = 48; 
  vec.resize( maxCountElementInVec );
  int countElement  = sizeof( vec ) / sizeof( vec[0] );
  
  printf("%d ",countElement); // return 3
  </code></pre>
  
  <p>&lt;...></p>
  
  <pre><code>vec.push_back( some_cpp_obj );
  int countElement  = sizeof( vec ) / sizeof( vec[0] );
  if( countElement &gt; maxCountElementInVec ) printf("Evrika"); 
  printf("%d ",countElement); // return 3
  </code></pre>
  
  <p>CountElement always is 3</p>