|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r82028 - in sandbox-branches/geometry/index: boost/geometry/extensions/index test
From: adam.wulkiewicz_at_[hidden]
Date: 2012-12-16 13:45:24
Author: awulkiew
Date: 2012-12-16 13:45:23 EST (Sun, 16 Dec 2012)
New Revision: 82028
URL: http://svn.boost.org/trac/boost/changeset/82028
Log:
Added templated versions of static_vector copy ctor and assignment.
GCC compile error fixed in test.
Text files modified:
sandbox-branches/geometry/index/boost/geometry/extensions/index/static_vector.hpp | 19 ++++++++++++++++++-
sandbox-branches/geometry/index/test/static_vector.cpp | 2 +-
2 files changed, 19 insertions(+), 2 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-16 13:45:23 EST (Sun, 16 Dec 2012)
@@ -75,7 +75,15 @@
static_vector(static_vector const& other)
: m_size(other.m_size)
{
- //BOOST_ASSERT_MSG(other.m_size <= Capacity, "size can't exceed the capacity");
+ this->uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw
+ }
+
+ // strong
+ template <size_t C>
+ static_vector(static_vector<value_type, C> const& other)
+ : m_size(other.m_size)
+ {
+ BOOST_ASSERT_MSG(other.m_size <= Capacity, "size can't exceed the capacity");
//if ( Capacity <= other.m_size ) throw std::bad_alloc();
this->uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw
@@ -97,6 +105,15 @@
return *this;
}
+ // basic
+ template <size_t C>
+ static_vector & operator=(static_vector<value_type, C> const& other)
+ {
+ assign(other.begin(), other.end()); // may throw
+
+ return *this;
+ }
+
// nothrow
~static_vector()
{
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-16 13:45:23 EST (Sun, 16 Dec 2012)
@@ -426,7 +426,7 @@
for ( size_t i = 0 ; i <= h ; ++i )
{
static_vector<T, N> s1(s);
- std::list<T>::iterator it = l.begin();
+ typename std::list<T>::iterator it = l.begin();
std::advance(it, n);
s1.insert(s1.begin() + i, l.begin(), it);
BOOST_CHECK(s1.size() == h+n);
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