In what order does evaluation of post-increment operator happen?

Posted by sum1stolemyname on Stack Overflow See other posts from Stack Overflow or by sum1stolemyname
Published on 2010-03-29T14:20:00Z Indexed on 2010/03/30 5:33 UTC
Read the original article Hit count: 313

Filed under:
|
|

Given

std::vector<CMyClass> objects;
CMyClass list[MAX_OBJECT_COUNT];

Is it wise to do this?

for(unsigned int i = 0; i < objects.size(); list[i] = objects.at(i++));

Or should I expand my loop to this?

for(unsigned int i = 0; i < objects.size(); i++)
{
  list[i] = objects.at(i);
}

© Stack Overflow or respective owner

Related posts about c++

Related posts about operator-precedence