在重构Handler时遇到bit field初始化问题

由于要支持嵌入式产品,CoreLooper只能坚守c++ 11

为了节省内存,Handler中有些成员变量采用bit field,但c++ 11不支持 bit field 

只有c++20才支持如下用法

class Handler

{

 int x1 : 8 = 42;
 int x2 : 8 { 42 };   
};

详见

https://en.cppreference.com/w/cpp/language/bit_field



猜你喜欢

转载自blog.csdn.net/xwpcom/article/details/80866099