Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51666 - in branches/release/boost/numeric/ublas: . detail
From: guwi17_at_[hidden]
Date: 2009-03-09 16:24:11


Author: guwi17
Date: 2009-03-09 16:24:11 EDT (Mon, 09 Mar 2009)
New Revision: 51666
URL: http://svn.boost.org/trac/boost/changeset/51666

Log:
detail/concepts.hpp: added read only vector concept
storage_sparse.hpp: removed wrong structure check, added check for empty sequence to erase(it1, it2)

Text files modified:
   branches/release/boost/numeric/ublas/detail/concepts.hpp | 10 ++++++++++
   branches/release/boost/numeric/ublas/storage_sparse.hpp | 2 +-
   2 files changed, 11 insertions(+), 1 deletions(-)

Modified: branches/release/boost/numeric/ublas/detail/concepts.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/detail/concepts.hpp (original)
+++ branches/release/boost/numeric/ublas/detail/concepts.hpp 2009-03-09 16:24:11 EDT (Mon, 09 Mar 2009)
@@ -942,6 +942,16 @@
         }
 #endif
 
+ // read only vectors
+ {
+ typedef vector_view<T> container_model;
+ function_requires< RandomAccessContainerConcept<container_model> >();
+ function_requires< VectorConcept<container_model> >();
+ function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_iterator> >();
+ function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_reverse_iterator> >();
+ }
+
+
         // Vector
 #if defined (INTERNAL_VECTOR) || defined (INTERNAL_VECTOR_DENSE)
         {

Modified: branches/release/boost/numeric/ublas/storage_sparse.hpp
==============================================================================
--- branches/release/boost/numeric/ublas/storage_sparse.hpp (original)
+++ branches/release/boost/numeric/ublas/storage_sparse.hpp 2009-03-09 16:24:11 EDT (Mon, 09 Mar 2009)
@@ -390,7 +390,6 @@
             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 ());
@@ -410,6 +409,7 @@
         }
         // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it.
         void erase (iterator it1, iterator it2) {
+ if (it1 == it2) return /* nothing to erase */;
             BOOST_UBLAS_CHECK (begin () <= it1 && it1 < it2 && it2 <= end (), bad_index ());
             std::copy (it2, end (), it1);
             resize (size () - (it2 - it1));


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk