title: Boost Multiindex: Example compiles in cpp files but not in header
body: <p>I am trying to compile the boost Multiindex <a href="http://www.boost.org/doc/libs/1_55_0b1/libs/multi_index/doc/tutorial/basics.html#key_extraction" rel="nofollow">example</a> </p>
  
  <p>I have a project consisting of multiple header and source files. 
  When I put the following code into some source file it works well, but it would give me the errors below, when I this code into a header file. Both header and cpp include the required boost header files and boost works fine otherwise.</p>
  
  <p>I have never encountered such a problem and I am quite confused as what the reason could be. </p>
  
  <pre><code>// define a multiply indexed set with indices by id and name
  typedef multi_index_container&lt;
    employee,
    indexed_by&lt;
      // sort by employee::operator&lt;
      ordered_unique&lt;identity&lt;employee&gt; &gt;,
  
      // sort by less&lt;string&gt; on name
      ordered_non_unique&lt;member&lt;employee,std::string,&amp;employee::name&gt; &gt;
    &gt; 
  &gt; employee_set;
  </code></pre>
  
  <p>where employee is a simple struct.</p>
  
  <pre><code>void print_out_by_name(const employee_set&amp; es)
      {
        // get a view to index #1 (name)
       const employee_set::nth_index&lt;1&gt;::type&amp; name_index=es.get&lt;1&gt;();
        // use name_index as a regular std::set
      }
  </code></pre>
  
  <p>missing 'typename' prior to dependent type name 'employee_set::nth_index'
           const employee_set::nth_index&lt;1>::type&amp; name_index=es.get&lt;1>();</p>
  
  <p>expected unqualified-id
           const employee_set::nth_index&lt;1>::type&amp; name_index=es.get&lt;1>();</p>