[Boost-bugs] [Boost C++ Libraries] #2423: map_array insert has invalid assertion

Subject: [Boost-bugs] [Boost C++ Libraries] #2423: map_array insert has invalid assertion
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-10-18 11:32:00


#2423: map_array insert has invalid assertion
------------------------------------------------------+---------------------
 Reporter: benson margulies <bimargulies_at_[hidden]> | Owner: guwi17
     Type: Bugs | Status: new
Milestone: Boost 1.37.0 | Component: uBLAS
  Version: Boost 1.36.0 | Severity: Problem
 Keywords: |
------------------------------------------------------+---------------------
 The external logic check in here appears to be wrong. The check is applied
 when the code sees the need to insert a new element in the underlying
 representation 'in the middle' -- the lower bound does not return end, and
 and the slot it returns does not have the correct index. The check
 requires the map to be empty or that the iterator is at the end, thus
 refusing to insert into the middle.


  // Form Unique Associative Container concept
         // 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 != 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 ());
             resize (size () + 1);
             it = begin () + n; // allow for invalidation
             std::copy_backward (it, end () - 1, end ());
             *it = p;
             return std::make_pair (it, true);
         }

-- 
Ticket URL: <http://svn.boost.org/trac/boost/ticket/2423>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC