As a general guideline in IMP get_ methods never returns a reference
and so doing things like get_foo.begin() is never a safe thing. Any
such method which happens to return a reference is just an
optimization for efficiency and might change later.
The only way I know to nicely catch the problem that Keren encountered
is to turn on iterator debugging in gcc, but that changes the C++ ABI
and so is a bit awkward if you link against any other C++ libraries.