I am trying to compile the boost Multiindex example
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.
I have never encountered such a problem and I am quite confused as what the reason could be.
// define a multiply indexed set with indices by id and name
typedef multi_index_container<
employee,
indexed_by<
// sort by employee::operator<
ordered_unique<identity<employee> >,
// sort by less<string> on name
ordered_non_unique<member<employee,std::string,&employee::name> >
>
> employee_set;
where employee is a simple struct.
void print_out_by_name(const employee_set& es)
{
// get a view to index #1 (name)
const employee_set::nth_index<1>::type& name_index=es.get<1>();
// use name_index as a regular std::set
}
missing 'typename' prior to dependent type name 'employee_set::nth_index' const employee_set::nth_index<1>::type& name_index=es.get<1>();
expected unqualified-id const employee_set::nth_index<1>::type& name_index=es.get<1>();