我有这些typedef:
typedef pair<k2Base, list<v2Base>> shuffled_pair;
typedef list<shuffled_pair> shuffled_list;
Run Code Online (Sandbox Code Playgroud)
而这个功能:
shuffled_pair getItem(unsigned int index){
return this->_items[index];
}
Run Code Online (Sandbox Code Playgroud)
其中this->_items的类型是shuffled_list在typedef的声明.
我从编译器得到这个错误:
Type 'const shuffled_list' (aka 'const list<pair<k2Base, list<v2Base> > >') does not provide a subscript operator
Run Code Online (Sandbox Code Playgroud)
但是类型基本上是列表类型,那么问题是什么?