title: Obtain container type from (its) iterator type in C++ (STL)
body: <p>It is easy given a container to get the associated iterators, example:</p>
  
  <pre><code>std::vector&lt;double&gt;::iterator i; //An iterator to a std::vector&lt;double&gt;
  </code></pre>
  
  <p>I was wondering if it is possible, given an iterator type, to deduce the type of the "corresponding container" (here I am assuming that for each container there is one and only one (non-const) iterator).</p>
  
  <p>More precisely, I would like a template metafunction that works with all STL containers (without having to specialize it manually for each single container) such that, for example:</p>
  
  <pre><code>ContainerOf&lt; std::vector&lt;double&gt;::iterator &gt;::type 
  </code></pre>
  
  <p>evaluates to </p>
  
  <pre><code>std::vector&lt;double&gt;
  </code></pre>
  
  <p>Is it possible?
  If not, why?</p>
  
  <p>Thank you in advance for any help!</p>