Hidden Features of C++? -
no c++ love when comes "hidden features of" line of questions? figured throw out there. of hidden features of c++?
most c++ programmers familiar ternary operator:
x = (y < 0) ? 10 : 20;
however, don't realize can used lvalue:
(a == 0 ? : b) = 1;
which shorthand for
if (a == 0) = 1; else b = 1;
use caution :-)
Comments
Post a Comment