Use this syntax instead of your nested typedefs:
typedef typename conn_table_t::template nth_index<0>::type conn_table_by_id_type;
The typename keyword is used here as a qualifier, so that the compiler knows that conn_table_t::template nth_index<0>::type is a type. This special use of typename is only required in templates.
The template keyword is used here as a qualifier for distingush member templates from other names.
In addition, this line is invalid:
typedef boost::shared_ptr conn_ptr_t;
You cannot create typedef templates. You can use only typedef types. Perhaps you wanted to write:
typedef typename boost::shared_ptr<T> conn_ptr_t;
One last mistake: you are trying to give two typedefs the same name: conn_table_by_id_type
You should use BOOST_MULTI_INDEX_CONST_MEM_FUN(T, std::string, id) instead of BOOST_MULTI_INDEX_CONST_MEM_FUN(T, std::string, T::id) as described here .
In response to your last comment: this snippet compiles for me:
void foo(std::string id) { conn_table_by_id_type& id_type_view = conn_table_.template get<0>(); typename conn_table_by_id_type::const_iterator it = id_type_view.find(id); }
Where foo is a member function inside the conn_mgr template. I guess this is what you tried to do.
You must write helper methods that get references to your three different conn_table_ . This will make things much more concise. For instance:
conn_table_by_id_type & by_id_type() {return conn_table_.template get<0>();} void foo2(std::string id) { typename conn_table_by_id_type::const_iterator it = by_id_type().find(id); }