|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r82099 - in sandbox/static_vector/boost/container: . detail
From: adam.wulkiewicz_at_[hidden]
Date: 2012-12-19 11:07:36
Author: awulkiew
Date: 2012-12-19 11:07:35 EST (Wed, 19 Dec 2012)
New Revision: 82099
URL: http://svn.boost.org/trac/boost/changeset/82099
Log:
Fixed error in construct() for Iterator different than a pointer.
Text files modified:
sandbox/static_vector/boost/container/detail/static_vector_util.hpp | 36 ++++++++++++++++++++++++++++++++++--
sandbox/static_vector/boost/container/static_vector.hpp | 1 +
2 files changed, 35 insertions(+), 2 deletions(-)
Modified: sandbox/static_vector/boost/container/detail/static_vector_util.hpp
==============================================================================
--- sandbox/static_vector/boost/container/detail/static_vector_util.hpp (original)
+++ sandbox/static_vector/boost/container/detail/static_vector_util.hpp 2012-12-19 11:07:35 EST (Wed, 19 Dec 2012)
@@ -318,7 +318,7 @@
try
{
for ( ; it != last ; ++it )
- new (it) value_type(); // may throw
+ new (boost::addressof(*it)) value_type(); // may throw
}
catch(...)
{
@@ -351,7 +351,7 @@
template <typename I, typename V>
inline void uninitialized_fill(I pos, V const& v)
{
- new (static_cast<void*>(&*pos)) V(v); // may throw
+ new (static_cast<void*>(boost::addressof(*pos))) V(v); // may throw
}
template <typename I, typename O>
@@ -372,6 +372,38 @@
*pos = v; // may throw
}
+template <typename I>
+void destroy(I first, I last)
+{
+ typedef typename boost::iterator_value<I>::type value_type;
+ for ( ; first != last ; ++first )
+ first->~value_type();
+}
+
+template <typename I>
+void destroy(I pos)
+{
+ typedef typename boost::iterator_value<I>::type value_type;
+ pos->~value_type();
+}
+
+template <typename I>
+void construct(I first, I last)
+{
+ typedef typename boost::iterator_value<I>::type value_type;
+ I it = first;
+ try
+ {
+ for ( ; it != last ; ++it )
+ new (boost::addressof(*it)) value_type(); // may throw
+ }
+ catch(...)
+ {
+ destroy(first, it);
+ throw;
+ }
+}
+
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// uninitialized_copy_checked
Modified: sandbox/static_vector/boost/container/static_vector.hpp
==============================================================================
--- sandbox/static_vector/boost/container/static_vector.hpp (original)
+++ sandbox/static_vector/boost/container/static_vector.hpp 2012-12-19 11:07:35 EST (Wed, 19 Dec 2012)
@@ -715,6 +715,7 @@
};
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+
template<typename Value, typename StoredSizeType>
class static_vector<Value, 0, StoredSizeType>
{
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