Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82208 - in sandbox/static_vector/boost/container: . detail
From: adam.wulkiewicz_at_[hidden]
Date: 2012-12-25 18:38:35


Author: awulkiew
Date: 2012-12-25 18:38:34 EST (Tue, 25 Dec 2012)
New Revision: 82208
URL: http://svn.boost.org/trac/boost/changeset/82208

Log:
BOOST_NO_EXCEPTIONS handled differently, used Boost.Move rvref and assign template macros
Text files modified:
   sandbox/static_vector/boost/container/detail/static_vector_util.hpp | 54 ++++++++++++++++++++--------------------
   sandbox/static_vector/boost/container/static_vector.hpp | 12 ++------
   2 files changed, 30 insertions(+), 36 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-25 18:38:34 EST (Tue, 25 Dec 2012)
@@ -38,6 +38,17 @@
 #include <boost/utility/addressof.hpp>
 #include <boost/iterator/iterator_traits.hpp>
 
+#ifdef BOOST_NO_EXCEPTIONS
+#define BOOST_CONTAINER_STATIC_VECTOR_TRY try
+#define BOOST_CONTAINER_STATIC_VECTOR_CATCH_ALL catch(...)
+#define BOOST_CONTAINER_STATIC_VECTOR_THROW throw
+#else
+#define BOOST_CONTAINER_STATIC_VECTOR_TRY
+#define BOOST_CONTAINER_STATIC_VECTOR_CATCH_ALL if(false)
+#define BOOST_CONTAINER_STATIC_VECTOR_THROW
+#endif
+
+
 #ifndef BOOST_NO_EXCEPTIONS
 // TODO - move this to the other, optional file?
 #include <vector>
@@ -302,20 +313,19 @@
     //return boost::uninitialized_move(first, last, dst); // may throw
 
     O o = dst;
-#ifndef BOOST_NO_EXCEPTIONS
- try
-#endif // BOOST_NO_EXCEPTIONS
+
+ BOOST_CONTAINER_STATIC_VECTOR_TRY
     {
         typedef typename std::iterator_traits<O>::value_type value_type;
         for (; first != last; ++first, ++o )
             new (boost::addressof(*o)) value_type(boost::move(*first));
     }
-#ifndef BOOST_NO_EXCEPTIONS
- catch (...)
+ BOOST_CONTAINER_STATIC_VECTOR_CATCH_ALL
     {
         destroy(dst, o);
+ BOOST_CONTAINER_STATIC_VECTOR_THROW;
     }
-#endif // BOOST_NO_EXCEPTIONS
+
     return dst;
 }
 
@@ -451,20 +461,17 @@
 {
     typedef typename boost::iterator_value<I>::type value_type;
     I it = first;
-#ifndef BOOST_NO_EXCEPTIONS
- try
-#endif // BOOST_NO_EXCEPTIONS
+
+ BOOST_CONTAINER_STATIC_VECTOR_TRY
     {
         for ( ; it != last ; ++it )
             new (boost::addressof(*it)) value_type(); // may throw
     }
-#ifndef BOOST_NO_EXCEPTIONS
- catch(...)
+ BOOST_CONTAINER_STATIC_VECTOR_CATCH_ALL
     {
         destroy(first, it);
- throw;
+ BOOST_CONTAINER_STATIC_VECTOR_THROW;
     }
-#endif // BOOST_NO_EXCEPTIONS
 }
 
 template <typename I>
@@ -537,20 +544,16 @@
     typedef typename boost::iterator_value<I>::type value_type;
     I it = first;
     
-#ifndef BOOST_NO_EXCEPTIONS
- try
-#endif // BOOST_NO_EXCEPTIONS
+ BOOST_CONTAINER_STATIC_VECTOR_TRY
     {
         for ( ; it != last ; ++it )
             new (boost::addressof(*it)) value_type(); // may throw
     }
-#ifndef BOOST_NO_EXCEPTIONS
- catch(...)
+ BOOST_CONTAINER_STATIC_VECTOR_CATCH_ALL
     {
         destroy(first, it);
- throw;
+ BOOST_CONTAINER_STATIC_VECTOR_THROW;
     }
-#endif // BOOST_NO_EXCEPTIONS
 }
 
 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
@@ -562,9 +565,8 @@
 {
     std::size_t count = 0;
     F it = dest;
-#ifndef BOOST_NO_EXCEPTIONS
- try
-#endif // BOOST_NO_EXCEPTIONS
+
+ BOOST_CONTAINER_STATIC_VECTOR_TRY
     {
         for ( ; first != last ; ++it, ++first, ++count )
         {
@@ -574,13 +576,11 @@
             uninitialized_fill(it, *first); // may throw
         }
     }
-#ifndef BOOST_NO_EXCEPTIONS
- catch(...)
+ BOOST_CONTAINER_STATIC_VECTOR_CATCH_ALL
     {
         destroy(dest, it);
- throw;
+ BOOST_CONTAINER_STATIC_VECTOR_THROW;
     }
-#endif // BOOST_NO_EXCEPTIONS
 
     return count;
 }

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-25 18:38:34 EST (Tue, 25 Dec 2012)
@@ -34,9 +34,6 @@
 
 #if defined(BOOST_NO_RVALUE_REFERENCES)
 
-#define BOOST_CONTAINER_STATIC_VECTOR_ASSIGN_REF(V, C, S) boost::rv< static_vector<V, C, S> > const&
-#define BOOST_CONTAINER_STATIC_VECTOR_RV_REF(V, C, S) boost::rv< static_vector<V, C, S> > &
-
 #define BOOST_CONTAINER_STATIC_VECTOR_COPYABLE_AND_MOVABLE() \
 BOOST_COPYABLE_AND_MOVABLE(static_vector) \
 public: \
@@ -51,9 +48,6 @@
 
 #else
 
-#define BOOST_CONTAINER_STATIC_VECTOR_ASSIGN_REF(V, C, S) static_vector<V, C, S> const&
-#define BOOST_CONTAINER_STATIC_VECTOR_RV_REF(V, C, S) static_vector<V, C, S> &&
-
 #define BOOST_CONTAINER_STATIC_VECTOR_COPYABLE_AND_MOVABLE() \
 BOOST_COPYABLE_AND_MOVABLE(static_vector)
 
@@ -231,7 +225,7 @@
 
     // basic
     template <std::size_t C, typename S>
- static_vector & operator=(BOOST_CONTAINER_STATIC_VECTOR_ASSIGN_REF(value_type, C, S) other)
+ static_vector & operator=(BOOST_MOVE_COPY_ASSIGN_REF_3_TEMPL_ARGS(static_vector, value_type, C, S) other)
     {
         this->assign(other.begin(), other.end()); // may throw
 
@@ -253,7 +247,7 @@
     // nothrow or strong (based on traits, default nothrow)
     // (note: linear complexity)
     template <std::size_t C, typename S>
- static_vector(BOOST_CONTAINER_STATIC_VECTOR_RV_REF(value_type, C, S) other)
+ static_vector(BOOST_RV_REF_3_TEMPL_ARGS(static_vector, value_type, C, S) other)
         : m_size(other.m_size)
     {
         errh::check_capacity(*this, other.size()); // may throw
@@ -283,7 +277,7 @@
     // nothrow or basic (based on traits, default nothrow)
     // (note: linear complexity)
     template <std::size_t C, typename S>
- static_vector & operator=(BOOST_CONTAINER_STATIC_VECTOR_RV_REF(value_type, C, S) other)
+ static_vector & operator=(BOOST_RV_REF_3_TEMPL_ARGS(static_vector, value_type, C, S) other)
     {
         errh::check_capacity(*this, other.size()); // may throw
 


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