ptr_vector hasn't been updated for C++11, so despite being specifically
designed to store pointers to objects it's less safe and not really any
easier to use than a regular vector of unique_ptrs
iterator_to requires that the object be in the list, which is sometimes
not the case when processing a commit which removed the active line or a
selected line. To handle this, add a checked version that returns
Events.end() when it is not in the list rather than crashing.