title: Am I not using typeof() correctly here?
body: <p>My code looks like this</p>
  
  <pre><code>#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
  
  ...
  
  typedef vector&lt;long&gt; vl;
  vl numbers;
  
  ...
  
  tr(numbers, j) { // this is line 95
      ...
  }
  </code></pre>
  
  <p>The code looks okay to me, but not to my compiler! Mercilessly, I am given the following errors:</p>
  
  <blockquote>
    <p>code.cpp: In function ‘int main()’:</p>
    
    <p>code.cpp:95:9: error: specialization of ‘std::vector::iterator’ after instantiation</p>
    
    <p>code.cpp:95:9: error: expected primary-expression before ‘typeof’</p>
    
    <p>code.cpp:95:9: error: expected ‘;’ before ‘typeof’</p>
    
    <p>code.cpp:95:9: error: name lookup of ‘j’ changed for ISO ‘for’ scoping</p>
    
    <p>code.cpp:95:9: note: (if you use ‘-fpermissive’ G++ will accept your
    code)</p>
    
    <p>code.cpp:95:9: error: no match for ‘operator!=’ in ‘j !=
    numbers.std::vector&lt;_Tp, _Alloc>::end with _Tp = long int, _Alloc =
    std::allocator, std::vector&lt;_Tp, _Alloc>::iterator =
    __gnu_cxx::__normal_iterator >, typename std::_Vector_base&lt;_Tp, _Alloc>::_Tp_alloc_type::pointer =
    long int*’</p>
  </blockquote>
  
  <p>What am I missing here?</p>