Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82003 - in sandbox-branches/geometry/index: boost/geometry/extensions/index test
From: adam.wulkiewicz_at_[hidden]
Date: 2012-12-15 20:02:38


Author: awulkiew
Date: 2012-12-15 20:02:38 EST (Sat, 15 Dec 2012)
New Revision: 82003
URL: http://svn.boost.org/trac/boost/changeset/82003

Log:
Fixed wrong assert in static_vector::insert(pos, val)
Test added.
Text files modified:
   sandbox-branches/geometry/index/boost/geometry/extensions/index/static_vector.hpp | 2 +-
   sandbox-branches/geometry/index/test/static_vector.cpp | 10 ++++++++++
   2 files changed, 11 insertions(+), 1 deletions(-)

Modified: sandbox-branches/geometry/index/boost/geometry/extensions/index/static_vector.hpp
==============================================================================
--- sandbox-branches/geometry/index/boost/geometry/extensions/index/static_vector.hpp (original)
+++ sandbox-branches/geometry/index/boost/geometry/extensions/index/static_vector.hpp 2012-12-15 20:02:38 EST (Sat, 15 Dec 2012)
@@ -167,7 +167,7 @@
     {
         // TODO change name of this macro
         BOOST_GEOMETRY_INDEX_ASSERT_UNUSED_PARAM(difference_type dist = std::distance(this->begin(), position));
- BOOST_ASSERT_MSG(0 <= dist && (sizeof(dist)<=sizeof(m_size)?((size_type)dist<m_size):(dist<(difference_type)m_size)), "invalid iterator");
+ BOOST_ASSERT_MSG(0 <= dist && (sizeof(dist)<=sizeof(m_size)?((size_type)dist<=m_size):(dist<=(difference_type)m_size)), "invalid iterator");
         
         BOOST_ASSERT_MSG(m_size < Capacity, "size can't exceed the capacity");
         //if ( Capacity <= m_size ) throw std::bad_alloc();

Modified: sandbox-branches/geometry/index/test/static_vector.cpp
==============================================================================
--- sandbox-branches/geometry/index/test/static_vector.cpp (original)
+++ sandbox-branches/geometry/index/test/static_vector.cpp 2012-12-15 20:02:38 EST (Sat, 15 Dec 2012)
@@ -363,6 +363,16 @@
         for ( size_t i = 0 ; i < h ; ++i )
             BOOST_CHECK(s1[i+h] == T(i));
     }
+ {
+ static_vector<T, N> s1(s);
+ for ( size_t i = 0 ; i < h ; ++i )
+ s1.insert(s1.end(), v);
+ BOOST_CHECK(s1.size() == 2*h);
+ for ( size_t i = 0 ; i < h ; ++i )
+ BOOST_CHECK(s1[i] == T(i));
+ for ( size_t i = 0 ; i < h ; ++i )
+ BOOST_CHECK(s1[i+h] == v);
+ }
 }
 
 int test_main(int, char* [])


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