std::pair 是否有 size() 成员函数?

-2 c++ hash std-pair

我正在关注哈希表实现教程并遇到了这个:

class HashTable {
private:
    static const int hashGroups = 10;
    std::list<std::pair<int,std::string>> table[hashGroups];

Run Code Online (Sandbox Code Playgroud)
bool HashTable::isEmpty() const {
    int sum{};
    for(int i{}; i < hashGroups; i++) {
        sum += table[i].size();
    }
    
    if(!sum) {
        return true;
    }
    return false;
}
Run Code Online (Sandbox Code Playgroud)

在 isEmpty() 成员函数中,为什么 table[i].size() 有效?在我的解释中,table 是一个对的列表,因此,table[i] 应该在索引 [i] 处返回一个对。但是,std::pair 中没有成员函数 size()。

Mik*_*CAT 8

table是阵列std::liststd::pair,所以table[i]是一个std::list并且它具有size()的功能。