This is a valid code:
for (int i = 0; i < (p_size < size ? p_size : size); i++);
This is the wrong code:
for (int i = 0; i < {p_size < size ? p_size : size}; i++);
The presence of braces in the middle of an expression like this is not valid.
I would also generally recommend std::min:
for (int i = 0; i < std::min(p_size, size); i++);
source
share