title: How to check that the passed Iterator is a random access iterator?
body: <p>I have the following code, which does some iterator arithmetic:</p>
  
  <pre><code>template&lt;class Iterator&gt;
  void Foo(Iterator first, Iterator last) {
    typedef typename Iterator::value_type Value;
    std::vector&lt;Value&gt; vec;
    vec.resize(last - first);
    // ...
  }
  </code></pre>
  
  <p>The <code>(last - first)</code> expression works (AFAIK) only for random access iterators (like the ones from <code>vector</code> and <code>deque</code>). How can I check in the code that the passed iterator meets this requirement?</p>