title: boost multi_index get on dependent type
body: <p>I've run into an issue where, for a dependent type, <code>boost::multi_index::multi_index_container&lt;...&gt;::get&lt;C&gt;()</code> breaks if <code>C</code> is a dependent type. The same does not occur if it's not dependent. MCVE, g++ 7.1.0 (also 6.3.0 if you declare is_same_v&lt;>):</p>
  
  <pre><code>#include &lt;type_traits&gt;                                                                                             
  #include &lt;boost/multi_index_container.hpp&gt;                                                                         
  #include &lt;boost/multi_index/ordered_index.hpp&gt;                                                                     
  #include &lt;boost/multi_index/identity.hpp&gt;                                                                          
  #include &lt;boost/multi_index/member.hpp&gt;                                                                            
  #include &lt;boost/multi_index/mem_fun.hpp&gt;                                                                           
  #include &lt;boost/multi_index/random_access_index.hpp&gt;                                                               
  
  #define MEMBER(T, M)        boost::multi_index::member&lt;T, decltype(T::M), &amp;T::M&gt;                                   
  #define TAGNMEMBER(T, M)    boost::multi_index::tag&lt;MEMBER(T, M)&gt;, MEMBER(T, M)                                    
  
  namespace ns1 {                                                                                                    
      struct Elem {                                                                                                  
          size_t id_;                                                                                                
  
          bool operator&lt;(const Elem&amp; rhs) const { return id_ &lt; rhs.id_; }                                            
      };                                                                                                             
  
      using Cont = boost::multi_index::multi_index_container&lt;                                                        
          Elem,                                                                                                      
          boost::multi_index::indexed_by&lt;                                                                            
              boost::multi_index::ordered_unique&lt;boost::multi_index::identity&lt;Elem&gt;&gt;,                                
              boost::multi_index::ordered_unique&lt;TAGNMEMBER(Elem, id_)&gt;                                              
          &gt;                                                                                                          
      &gt;;                                                                                                             
  }                                                                                                                  
  
  namespace ns2 {                                                                                                    
  //    void f(ns1::Cont&amp; cont) // always works                                                                      
      template&lt;typename C&gt;                                                                                           
      void f(C&amp; cont)                                                                                                
      {                                                                                                              
          ns1::Cont&amp; c = cont;                                                                                       
          static_assert(std::is_same_v&lt;decltype(cont), ns1::Cont&amp;&gt;);                                                 
          cont.get&lt;MEMBER(ns1::Elem, id_)&gt;(); // v1 - error if dependent type                                        
          //c.get&lt;MEMBER(ns1::Elem, id_)&gt;();  // v2 - always works                                                   
      }                                                                                                              
  }                                                                                                                  
  
  
  int main()                                                                                                         
  {                                                                                                                  
      ns1::Cont cont;                                                                                                
      cont.insert({0});                                                                                              
      ns2::f(cont);                                                                                                  
  }
  </code></pre>
  
  <p>Could you please advise?</p>