what is this doing?
1 2
|
BOOL varab = TRUE;
if( m_List.size() > ( (varab) ? 13 : 12 ) )
|
Im really new to c++ and would appreciate if anyone could explain what this statement is doing and what type of operator it is, code is above!
That's the ternary operator. It works like this:
(condition ? if_true : if_false)
So basically it's comparing m_List.size() to either 13 or 12, depending on whether or not varab is true.
Another way to write that would be like this:
1 2 3 4 5
|
int compare;
if(varab) compare = 13;
else compare = 12;
if(m_List.size() > compare)
|
(a)?(b):(c)
is the same as
1 2 3
|
if (a)
then (b)
else (c)
|
Topic archived. No new replies allowed.