jeudi 21 décembre 2017

Unary operator precedence in c++

I have been trying to run below code snippet for efficient working.

auto searchLocation = SampleVector->end();
auto begin = SampleVector->begin();
for (; searchLocation-- != begin;) 
{
    /*Do some work here*/
}

as per c++ standards -- unary operator have higher precedence over != relational operator. But code keeps on crashing at for loop condition. Any help or guidance will be helpful.

Note:- have to use unary operator in condition for further programming. so can't draft unary operation inside loop.

Aucun commentaire:

Enregistrer un commentaire