title: Would a statically sized Rcpp empty list be more efficient than list.push_back()?
body: <p>If one wishes to iterate over a function and add the results to a list in Rcpp, one can use the <code>.push_back()</code> method, for example:</p>
  <pre><code>List appended_list() {
      List emptylist = List::create();
      for (int i = 0; i &lt; 3; i++) {
        emptylist.push_back(i);
      }
      return emptylist;
  }
  </code></pre>
  <p>However, am I correct in saying that the list gets redefined each time and thus this method is very inefficient? Is there a way to instead create a list of a static size (ie. create a list of <em>n</em> elements, where each element is <code>NULL</code> or <code>NA</code> or some such)? For example, to do this in R one would write:</p>
  <pre><code>emptylist &lt;- list()
  length(emptylist) &lt;- 3
  for (i in 1:3) {
    emptylist[[i]] &lt;- i
  }
  </code></pre>
  <p>Is there a way to do this in Rcpp please? Would it be more efficient?</p>