Is iter++->empty()
a legal expression?
iter
is an iterator
of a vector
of string
s.
I am asking because considering the precedence of the operators both ->
and ()
should precede the postfix increment but I really don't know how the operands should be grouped.
On my compiler it works (the expression yields the empty()
result for the first string and iter
points to the second string) but I'm still wondering if it is Undefined Behaviour.
Edit
I just found the solution (I think):
iter++->empty()
should be the same as (*iter++).empty()
therefore considering associativity and precedence rules the grouping should be:
(((*(iter++)).empty) ())
Is that correct?