Do not assume that Track::states() returns a reference to a container
so do NOT compare iterators obtained from two distinct calls to Track::states() -- instead, assign the return value to a variable(*), and then call begin() and end() on that variable (or use a range based loop which does so implicitly)
(*) the variable could be a const &
, as that extends the lifetime
of any temporary it is bound to (in case a value is returned)
Edited by Marco Cattaneo