casting a vector's size() as int does not work : <p>I am learning C++ on the fly and am having problems with vectors so I am writing some programs that use vectors to familiarize myself with them.</p>

<p>I was following the advice from this post regarding printing out the value of a vector's size() call:</p>

<p><a href="https://stackoverflow.com/questions/31196443/how-can-i-get-the-size-of-an-stdvector-as-an-int">How can I get the size of an std::vector as an int?</a></p>

<p>My code is a simple C++ code:</p>

<pre><code>#include &lt;vector&gt;

int main(int argc, char ** argv) {
   /* create an int vector of size 10, initialized to 0 */
   std::vector&lt;int&gt; int_list[10];
   int int_list_size;

   int_list_size = static_cast&lt;int&gt;(int_list.size()); // &lt;-- compilation error here
} // End main()
</code></pre>

<p>I'm on Ubuntu 16.04 and I get this error:</p>

<pre><code>"error: request for member 'size' in 'int_list', which is of non-class type 'std::vector&lt;int&gt; [10]'
</code></pre>

<p>Since the size of the vector int_list is 10, shouldn't size() return 10, which I can then cast to an int?</p>
