2
0
mirror of https://github.com/boostorg/ublas.git synced 2026-02-21 15:32:12 +00:00

FIX avoid past end derefence in insert THANKS Jan Amtrup

[SVN r31523]
This commit is contained in:
Michael Stevens
2005-11-01 09:01:20 +00:00
parent 495385dd0a
commit bc57b8147f

View File

@@ -378,7 +378,7 @@ namespace boost { namespace numeric { namespace ublas {
// BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it.
std::pair<iterator,bool> insert (const value_type &p) {
iterator it = detail::lower_bound (begin (), end (), p, detail::less_pair<value_type> ());
if (it->first == p.first)
if (it != end () && it->first == p.first)
return std::make_pair (it, false);
difference_type n = it - begin ();
BOOST_UBLAS_CHECK (size () == 0 || size () == size_type (n), external_logic ());