Why is move_iterator::operator-> deprecated in C++20?

Viewed 176

I read a C++20 proposal that was adopted about this subject and the article said.

The expression (*iter).x and the expression iter->x have the same semantics. For a move_iterator, *iter is an xvalue. iter->x, is an lvalue. Consequently, (*iter).x and iter->x can produce different behaviors.

Is this exactly why it is deprecated in C ++ 20? Are there any other concepts and disadvantages that should not be used? Is there anyone who could explain it better with the code example,whats the best practice?

0 Answers
Related