멀티 인텍스 컨테이너가 포함 된 일반 클래스를 저장소로 만들어야합니다. 컴파일 할 때 n 번째 인덱스 뷰를 정의한 곳에서 아래와 같은 오류가 발생합니다.다중 인덱스 컨테이너를 높이기위한 템플릿 매개 변수
오류 : 템플릿이 아닌 'nth_index가'템플릿으로 사용
/** * connection manager */
template < typename T, typename C > class conn_mgr: boost::noncopyable { public: /** * connection ptr */ typedef boost::shared_ptr conn_ptr_t;
/** * connection table type * It's a multi index container */ typedef boost::multi_index::multi_index_container < conn_ptr_t, boost::multi_index::indexed_by < //sequenced < >, boost::multi_index::hashed_unique < BOOST_MULTI_INDEX_CONST_MEM_FUN(T, std::string, T::id) >, boost::multi_index::hashed_non_unique < BOOST_MULTI_INDEX_CONST_MEM_FUN(T, std::string, T::type)>, boost::multi_index::hashed_non_unique < boost::multi_index::composite_key < conn_ptr_t, BOOST_MULTI_INDEX_CONST_MEM_FUN(T, std::string, T::id), BOOST_MULTI_INDEX_CONST_MEM_FUN(T, std::string, T::type) > > > > conn_table_t;//typedef for ConnectionIdView typedef conn_table_t::nth_index<0>::type conn_table_by_id_type; typedef conn_table_t::nth_index<1>::type conn_table_by_type; typedef conn_table_t::nth_index<2>::type conn_table_by_id_type;
개인 : conn_table_t의 conn_table_; }; 대신 중첩 된 형식 정의에 대한
and here how I am using in main.
int main(int argc, char** argv) { typedef conn_mgr < smpp_conn, smpp_config > smpp_conn_mgr_t; smpp_conn_mgr_t conn_mgr; }
템플릿을 typedef 할 수 없습니다. 이 줄은 유효하지 않습니다 :'typedef boost :: shared_ptr conn_ptr_t; ' –