Skip to content

Latest commit

 

History

History
11 lines (6 loc) · 767 Bytes

4.20.md

File metadata and controls

11 lines (6 loc) · 767 Bytes

(a) *iter++; is legal. The expression moves iter to point to the next element and returns the value of the original element.

(b) (*iter)++ is not legal. The expression means increasing value of the element, but the value is a string and string does not have ++ operator.

(c) *iter.empty() is not legal. Because iter is an iterator and has no member named empty.

(d) iter->empty() is legal. The expression means check if the string pointed by iter is empty.

(e) ++*iter is not legal. The expression means increasing value of the element, but the value is a string and string does not have ++ operator.

(f) iter++->empty() is legal. The expression means move iter to point to the next element and check if that string is empty.