title: Is it possible to access to a container from an iterator?
body: <p>For this question, consider a simple example of a function adding values in a vector :</p>
  
  <pre><code>void insert( std::set&lt;double&gt;::const_iterator from_begin,
               std::set&lt;double&gt;::const_iterator from_end,
               std::vector&lt;double&gt;::iterator to )
  {
    std::copy(from_begin, from_end, to);
  }
  </code></pre>
  
  <p>Now immagine I want to add a check on the capacity of my vector, <strong>is it possible to get the container on which <code>to</code> works ?</strong> Is it possible to do something like that ?</p>
  
  <pre><code>void insert( std::set&lt;double&gt;::const_iterator from_begin,
               std::set&lt;double&gt;::const_iterator from_end,
               std::vector&lt;double&gt;::iterator to )
  {
    std::vector&lt;double&gt;&amp; container = give_me_the_container(to);
    assert(container.size() + std::distance(from_end,from_begin) &lt; container.capacity());
    std::copy(from_begin, from_end, to);
  }
  </code></pre>
  
  <p><strong>Note:</strong> I use gcc 4.8.3. <strong>I don't use c++11</strong> for compatibility with old gcc versions.</p>