$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [MultiIndex] Indexing integers
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2014-07-29 11:53:54
Sensei <senseiwa <at> gmail.com> writes:
> 
> As JoaquÃn helped me out, I'm currently using his solution to test multi 
> index containers.
> 
> [...]
> 
> Following the example [1], I proceeded in defining the index type, but 
> here my compiler throws me two errors:
> 
>     error: missing 'typename' prior to dependent type name
>     'DataWithIndices::nth_index'
>      ^
> 
> and
> 
>     error: expected unqualified-id
>     typedef DataWithIndices::nth_index<3>::type byHashedIndex;
>                                       ^
> 
> So I followed the suggestion and used typename, but an error is there:
> 
>     error: use 'template' keyword to treat 'nth_index' as a dependent 
> template name
>     typedef typename DataWithIndices::nth_index<3>::type byHashedIndex;
>                                       ^
> 
> Again, I follow the suggestion, use template and it works. Adding the 
> following line from the example gives me an error:
> 
> error: expected expression
>          byHashedIndex &p = multiIndex_.get<3>();
>                                             ^
> 
> error: declaration of reference variable 'p' requires an initializer
>          byHashedIndex &p = multiIndex_.get<3>();
I think you need to write
byHashedIndex &p = multiIndex_.template get<3>();
(note the extra "template"). You might want to check the excellent
explanation on templates and dependent names given at
http://tinyurl.com/cmlqhcr .
Best,
JoaquÃn M López Muñoz
Telefónica