What exactly does this compiler error want me to perform? : <p>Thank you in advance for reading ! So this is the code : </p>

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

std::vector&lt;int&gt; MonkeyCount(int n);

int main() {

    MonkeyCount(4);

    return  0;


}


std::vector&lt;int&gt; MonkeyCount(int n) {
    std::vector&lt;int&gt; MonkeyCountV;
    for (unsigned int i = 1; i &lt;= n; i++) {

        MonkeyCountV.push_back(i);
    }
    for (unsigned int i = 0; i &lt;= MonkeyCountV.size(); i++) {
        std::cout &lt;&lt; MonkeyCount.at(i) &lt;&lt; " ";
    }
    return MonkeyCountV;
}

</code></pre>

<p>and the error is on line 23 : error C2227:  left of '->at' must point to class/struct/union/generic type
Now i red something about this, but i use this from an example i found on the internet on how to print a vector, and in that exaple, in works. The exaple is this : </p>

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

void print(std::vector&lt;int&gt; const&amp; input);

int main()
{
    std::vector&lt;int&gt; input = { 1, 2, 3, 4, 5 };
    print(input);

    return 0;
}
void print(std::vector&lt;int&gt; const&amp; input)
{
    for (unsigned int i = 0; i &lt; input.size(); i++) {
        std::cout &lt;&lt; input.at(i) &lt;&lt; ' ';
    }
}
</code></pre>
