logical or expression c++
- by user1870181
I have a problem using the Logical OR operator in C++. The problem is coming that the right-side expression is not evaluated if the left-side is true. I have two deque-s and I need to popLeft from them with a while, but if I can pop from the first deque, I don't pop from the second because is not evaluated, by the OR operator. How can I overcome this problem. Here is the piece of code:
while( D.popLeft( k ) || E.popLeft( m ) )
{
if( k < m )
{
C.pushRight( k );
E.pushLeft( m );
}
else
{
C.pushRight( m );
D.pushLeft( k );
}
}