title: MSVC++ Compiler error C2923 when passing template argument
body: <p>I have a <code>multi_index_container</code> of <code>struct Person</code>:</p>
  
  <pre><code>struct Person {
      std::string firstName;
      std::string lastName;
      int id;
      bool operator &lt;(const Person&amp; rhs) const {return id &lt; rhs.id;}
  };
  
  //index tags
  struct BaseIndexTag {};
  struct FirstName : BaseIndexTag {};
  struct LastName : BaseIndexTag {};
  struct ID : BaseIndexTag {};
  
  namespace bmi = boost::multi_index;
  
  typedef boost::multi_index_container&lt;
      Person, 
      bmi::indexed_by&lt;
      //PinsConnection operator &lt; ordering
      bmi::ordered_unique&lt;bmi::tag&lt;ID&gt;, bmi::identity&lt;Person&gt; &gt;,
      //order by first name
      bmi::ordered_non_unique&lt;bmi::tag&lt;FirstName&gt;, bmi::member&lt;Person, std::string, &amp;Person::firstName&gt; &gt;,
      //Order by last name
      bmi::ordered_non_unique&lt;bmi::tag&lt;LastName&gt;, bmi::member&lt;Person, std::string, &amp;Person::lastName&gt; &gt;
      &gt;
  &gt; PersonMultiSet; 
  </code></pre>
  
  <p>and a wrapper class for boost's <code>iterator_adaptor</code>:</p>
  
  <pre><code>template &lt;
  typename I      //Internal iterator type
  , typename C    //Container class
  &gt;   
  class IteratorAdaptor : public boost::iterator_adaptor &lt;
      IteratorAdaptor&lt;I,C&gt;,               //Derived
      I,                                  //Base      
      boost::use_default,                 //Value
      boost::forward_traversal_tag&gt;       //Traversal
  {
  private:
      friend class boost::iterator_core_access;
      friend C;
  public:
      IteratorAdaptor()
          : typename IteratorAdaptor&lt;I,C&gt;::iterator_adaptor_() {}
      explicit IteratorAdaptor(I&amp; b)
          : typename IteratorAdaptor&lt;I,C&gt;::iterator_adaptor_(b) {}
  };
  </code></pre>
  
  <p>Finally, I wrote a wrapper class for <code>PersonMultiSet</code>, in order to expose a clean interface to the users of this class and to avoid boost's <code>multi_index_container</code> somewhat cumbersome   interface:</p>
  
  <pre><code>class PersonContainer {
  public:
      typedef IteratorAdaptor&lt;PersonMultiSet::index&lt;ID&gt;::type::iterator, PersonContainer&gt; IDIterator;
      typedef IteratorAdaptor&lt;PersonMultiSet::index&lt;ID&gt;::type::const_iterator, PersonContainer&gt; IDConstIterator;
      typedef IteratorAdaptor&lt;PersonMultiSet::index&lt;FirstName&gt;::type::iterator, PersonContainer&gt; FirstNameIterator;
      typedef IteratorAdaptor&lt;PersonMultiSet::index&lt;FirstName&gt;::type::const_iterator, PersonContainer&gt; FirstNameConstIterator;
      typedef IteratorAdaptor&lt;PersonMultiSet::index&lt;LastName&gt;::type::iterator, PersonContainer&gt; LastNameIterator;
      typedef IteratorAdaptor&lt;PersonMultiSet::index&lt;LastName&gt;::type::const_iterator, PersonContainer&gt; LastNameConstIterator;
      template &lt;typename T&gt; //tag
      void foo(IteratorAdaptor&lt;PersonMultiSet::index&lt;T&gt;::type::iterator, PersonContainer&gt; &amp;it)
      {
          //...
      }
  private:
      PersonMultiSet people;
  };
  </code></pre>
  
  <p>Compiling this code under VS2010 produces the following error over the declaration of function foo:</p>
  
  <pre><code>1&gt;  main.cpp
  1&gt;main.cpp(70): warning C4346: 'boost::multi_index::multi_index_container&lt;Value,IndexSpecifierList&gt;::index&lt;T&gt;::boost::multi_index::multi_index_container&lt;Value1,IndexSpecifierList1,Allocator1&gt;::index&lt;Tag&gt;::type::iterator' : dependent name is not a type
  1&gt;          with
  1&gt;          [
  1&gt;              Value=Person,
  1&gt;              IndexSpecifierList=boost::multi_index::indexed_by&lt;boost::multi_index::ordered_unique&lt;boost::multi_index::tag&lt;ID&gt;,boost::multi_index::identity&lt;Person&gt;&gt;,boost::multi_index::ordered_non_unique&lt;boost::multi_index::tag&lt;FirstName&gt;,boost::multi_index::member&lt;Person,std::string,pointer-to-member(0x0)&gt;&gt;,boost::multi_index::ordered_non_unique&lt;boost::multi_index::tag&lt;LastName&gt;,boost::multi_index::member&lt;Person,std::string,pointer-to-member(0x20)&gt;&gt;&gt;
  1&gt;          ]
  1&gt;          prefix with 'typename' to indicate a type
  1&gt;main.cpp(70): error C2923: 'IteratorAdaptor' : 'boost::multi_index::multi_index_container&lt;Value,IndexSpecifierList&gt;::index&lt;T&gt;::boost::multi_index::multi_index_container&lt;Value1,IndexSpecifierList1,Allocator1&gt;::index&lt;Tag&gt;::type::iterator' is not a valid template type argument for parameter 'I'
  1&gt;          with
  1&gt;          [
  1&gt;              Value=Person,
  1&gt;              IndexSpecifierList=boost::multi_index::indexed_by&lt;boost::multi_index::ordered_unique&lt;boost::multi_index::tag&lt;ID&gt;,boost::multi_index::identity&lt;Person&gt;&gt;,boost::multi_index::ordered_non_unique&lt;boost::multi_index::tag&lt;FirstName&gt;,boost::multi_index::member&lt;Person,std::string,pointer-to-member(0x0)&gt;&gt;,boost::multi_index::ordered_non_unique&lt;boost::multi_index::tag&lt;LastName&gt;,boost::multi_index::member&lt;Person,std::string,pointer-to-member(0x20)&gt;&gt;&gt;
  1&gt;          ]
  1&gt;
  1&gt;Build FAILED.
  </code></pre>
  
  <p>It seems that the compiler doesn't allow the type <code>IteratorAdaptor&lt;PersonMultiSet::index&lt;T&gt;::type::iterator</code> do be determined upon first use (I get this error before I even try and instantiate <code>PersonContainer</code> or call foo).
  What am I doing wrong?</p>