As far as I know the reason it was removed.The expression (*i).m
, where i
is an iterator, and the expression i->m
have the same semantics.Input iterators are required to support the -> operator
, and move_iterator is an input iterator, so move_iterator’s arrow operator must satisfy that requirement.But I guess not like that.For a move_iterator, *i is an xvalue
, so (*i).m is also an xvalue
. i->m, however, is an lvalue
.Consequently, (*i).m
and i->m
can produce observably different behaviors as subexpressions.Is this exactly why it is deprecated in C ++ 20 ? Are there any other concepts and disadvantages that should not be used ?whats the best practice about this ?
jeudi 29 avril 2021
Why is move_iterator::operator-> deprecated in C++20?
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire