【发布时间】:2015-09-21 09:19:49
【问题描述】:
当我尝试在结构声明中初始化位字段时,MSVC++ 给我一个编译器错误:
struct SomeStruct
{
bool a : 1 = false; // compiler error
bool a = false : 1; // compiler error
} ;
在结构体声明中初始化位域的语法是什么?
【问题讨论】:
-
对不起,我终于想出了正确的关键字来找到已经提出的问题:Bit-fields "In-class initialization" results in "error: lvalue required as left operand of assignment"
标签: c++ c++11 visual-c++ syntax bit-fields