what is the difference between iter++->empty() and ++iter->empty()?
02:20 25 Jul 2021

Assuming that iter is a vector::iterator.

  1. I have understood that ++iter->empty() is illegal, ISO C++17 does not allow incrementing expression of type bool, indicating that ++iter->empty() equals ++(iter->empty()).
  2. Based on (1), why iter++->empty() doesn't equal (iter->empty())++ or ((*iter).empty())++, but equals (*iter++).empty()? thank you very much!
c++ c++11 c++17