【发布时间】:2018-09-08 13:36:03
【问题描述】:
我正在尝试使用以下 2 个值初始化 struct opcodeTable 的向量:
struct opcodeTableE {
uint16_t opcode;
uint16_t mask;
void (chipCpu::*instruction)(uint16_t);
};
std::vector<opcodeTableE> opcodetable{
{0x00E0, 0xFFFF, chipCpu::clearScreen},
{0x00EE, 0xFFFF, chipCpu::returnFromSub}
};
但我收到以下错误:
no instance of constructor "std::vector<_Tp, _Alloc>::vector [with _Tp=chipCpu::opcodeTableE, _Alloc=std::allocator<chipCpu::opcodeTableE>]" matches the argument list -- argument types are: ({...}, {...})
注意:我使用的是 C++14
【问题讨论】: