|
Boost Users : |
From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2007-11-20 13:27:43
----- Mensaje original -----
De: Ovanes Markarian <om_boost_at_[hidden]>
Fecha: Martes, Noviembre 20, 2007 4:57 pm
Asunto: [Boost-users] [multi-index] dereferencing the end iterator
Para: boost-users_at_[hidden]
> Hello Joaquín,
>
> today I faced some problem, when debugging the code.
[...]
> When created a view for vx_hash tag and going to change the
> invalid iteratorlike view.end(). Dereferencing view.end() fails
> as awaited, but this code which calls my TypeModifier:
>
> view.modify(view.end(), my_modifier);
>
> This will result in my_modifier call with dereferenced iterator,
which
> contains badly initialized object.
[...]
Calling modify(end(),...) is illegal just as dereferencing
end() is, but that does not mean that you can expect a crash when
doing so: as you're invoking undefined behavior anything can
happen.
If you want to make sure that these illegal operations are
properly detected and reported in a predictable way, take a
look at Boost.MultiIndex safe mode:
http://boost.org/libs/multi_index/doc/tutorial/debug.html#safe_mode
(Don't forget to turn it off in release mode). Hope this helps,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net