Parallel assignment in C++

前端 未结 6 854
醉酒成梦
醉酒成梦 2021-01-18 13:53

Is there any way of doing parallel assignment in C++? Currently, the below compiles (with warnings)

#include  

int main() { 
  int a = 4;
           


        
6条回答
  •  清酒与你
    2021-01-18 14:04

    Or Lua...
    There are tricks with C/C++, like using xor or operations, but with risk of overflow and such. Just do it the painful way, with three assignments. Not a big deal.

提交回复
热议问题