Boost logo

Boost Users :

Subject: Re: [Boost-users] re alization of Last Recently Used cache with boost::multi_index
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2009-03-04 16:29:53

Hi Pavel,

pavel5 wrote:
> I am trying to realize class for strings caching using boost::multi_index.
> [...]
> My class works without any problem, but i want to have template class, for
> easily type of key and value selection. I modified my source:
> [...]
> After modification, gcc compiler prints for line:
> LRUCacheItems::nth_index<0>::type& hash_index=cache.get<0>();
> many errors:[...]

Replace the offending line with

typename LRUCacheItems::nth_index<0>::type& hash_index=cache.template

Note the extra "typename" and also the "template" keyword between
"cache." and "get<0>()". After templatizing your LRUCache, the expression
happens to be in a so-called dependent context, and turns out you've got to
the compiler figure it out right (i.e. disambiguate from some other
theoretically possible in the given context). Learn more about this issue at

Hope this helps,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at