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

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -