结构体中vector的初始化报错:expected identifier before numeric constant

结构体中vector的初始化报错:expected identifier before numeric constant

结构体中vector初始化

起因:

我想在结构体中初始化含有3个元素的vector。

image

报错:

expected identifier before numeric constant,意思是数字常量前应该要有表示符。

原因:

编译器认为我正在定义一个函数名为 bit,返回类型为 vector<BIT> ,输入参数为(3,BIT(N)) 的函数,但是参数的定义方式有误。

修改:

image

posted @ 2024-07-29 01:29  Ke_scholar  阅读(9)  评论(0编辑  收藏  举报