我有这样的课:
class A {
std::vector<
std::vector<
std::pair<
uint32_t, std::reference_wrapper<std::vector<uint8_t>>>>>
table;
};
在类的构造函数中,我调整了向量的大小,就像这样table.resize(indexSize)
但是当我尝试推送项目时出现错误:
void A::insertItem(const uint32_t &g, const vector<uint8_t> &point)
{
this->table[g % this->indexSize].push_back(make_pair(g, point));
}
我想当我调整大小时,我需要传递某种构造函数?
我得到的错误是:
没有重载函数的实例 "std::vector<_Tp, _Alloc>::push_back [with _Tp=std::pair<uint32_t, std::reference_wrapper<std::vector<uint8_t, std::allocator<uint8_t>>> >, _Alloc=std::allocator<std::pair<uint32_t, std::reference_wrapper<std::vector<uint8_t, std::allocator<uint8_t>>>>>]" 匹配参数列表——参数类型是: (std::pair<uint32_t, std::vector<uint8_t, std::allocator<uint8_t>>>) -- 对象类型为:std::vector<std::pair<uint32_t, std::reference_wrapper<std ::vector<uint8_t, std::allocator<uint8_t>>>>, std::allocator<std::pair<uint32_t, std::reference_wrapper<std::vector<uint8_t, std::allocator<uint8_t>>> >>>