How to fill a C++ container using a (lambda) function? : <p>I want to initialize a container with pointers to objects. I currently have a loop like this:</p>

<pre><code>for(int i=0;i &lt; n;i++) {
    container.push_back(new Object());
}
</code></pre>

<p>Which C++ operation (i.e. similar to <code>std::transform</code>) is the right to replace this loop and initialize a container with <code>n</code> newly created objects?</p>
