|
Boost Users : |
From: Julius Ziegler (ziegler_at_[hidden])
Date: 2008-07-04 12:16:09
Hello,
I am having problems using a multi_index_container in the context of a
template class, and I am hoping someone here can help me. This is a
condensed example:
template<class T> struct C {
typedef multi_index_container<T> SomeSet;
SomeSet container;
// I learned I need typename, since this is an implicit type
typedef typename multi_index_container<T>::nth_index<0>::type
SomeSetIndex;
void f()
{
SomeSetIndex& index = container.get<0>();
}
};
The typedef for SomeSetIndex did not compile. g++-4.2 reported (I
stripped something from the message that I think is not relevant):
error: non-template 'nth_index' used as template
note: use 'multi_index_container<T, [stripped] >::template nth_index' to
indicate that it is a template
Now I (blindly) tried this declaration:
typedef typename multi_index_container<T>::template nth_index<0>::type
g++ gets past it, but now reports a syntax error in function f, when
index gets initialised.
Can someone please explain that first error message to me? Any help is
appreciated.
-J
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net