ensure that an iterator dereferences to a certain type
<p>I have to implement a function that takes an iterator. The iterator must dereference to a certain type, say int:</p>

<pre><code>template&lt;typename iter&gt;
  void f(iter i) {
  // do something here ...
  int t = *i;
  // do something here ...
}
</code></pre>

<p>The problem with this code is that if a user calls the function like this</p>

<pre><code>vector&lt;string&gt; v;
v.push_back("aaa");
f(v.begin());
</code></pre>

<p>he will see an error pointing to some place in my code, not in his code (which will be confusing to him). I want the error to be in user's code to ease debugging.</p>
