dimanche 25 juillet 2021

what is the difference between iter++->empty() and ++iter->empty()?

Assuming that iter is a vector<string>::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!

Aucun commentaire:

Enregistrer un commentaire