我遇到了一些可归结为以下内容的代码:
enum BAR { /* enum values omitted */ }
class Foo{
public:
void set(const BAR& bar);
private:
uint32_t bits;
};
void Foo::set(const BAR& bar)
{
(uint32_t&)bits = bits | bar;
}
Run Code Online (Sandbox Code Playgroud)
我不明白Foo :: set中赋值的c风格转换点.你为什么要施放作业的lhs?我疯了,还是有目的?
c++ ×1