Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82215 - in sandbox/static_vector/boost/container: . detail
From: adam.wulkiewicz_at_[hidden]
Date: 2012-12-26 15:27:28


Author: awulkiew
Date: 2012-12-26 15:27:27 EST (Wed, 26 Dec 2012)
New Revision: 82215
URL: http://svn.boost.org/trac/boost/changeset/82215

Log:
Added workaround of a Boost.Move bug.
Vectors iterators optimization are enabled by BOOST_CONTAINER_STATIC_VECTOR_ENABLE_VECTORS_OPTIMIZATION.
Text files modified:
   sandbox/static_vector/boost/container/detail/static_vector_util.hpp | 72 ++++++++++++++++++++-------------------
   sandbox/static_vector/boost/container/static_vector.hpp | 11 ++++-
   2 files changed, 45 insertions(+), 38 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-26 15:27:27 EST (Wed, 26 Dec 2012)
@@ -48,36 +48,33 @@
 #define BOOST_CONTAINER_STATIC_VECTOR_THROW
 #endif
 
+// TODO - move vectors iterators optimization to the other, optional file instead of checking defines?
 
-#ifndef BOOST_NO_EXCEPTIONS
-// TODO - move this to the other, optional file?
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+
+#if defined(BOOST_CONTAINER_STATIC_VECTOR_ENABLE_VECTORS_OPTIMIZATION) && !defined(BOOST_NO_EXCEPTIONS)
 #include <vector>
 #include <boost/container/vector.hpp>
-#endif // BOOST_NO_EXCEPTIONS
+#endif // BOOST_CONTAINER_STATIC_VECTOR_ENABLE_ITERATORS_OPTIMIZATION && !BOOST_NO_EXCEPTIONS
 
 namespace boost { namespace container { namespace static_vector_detail {
 
-// TODO
-// Does BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION checks have any sense?
-// Boost.MPL and Boost.Container might not be used but
-// Boost.Iterator also uses partial specialization
-// and in fact iterator_traits won't work if there is no partial specialization
-
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
-
 template <typename I>
 struct are_elements_contiguous : boost::is_pointer<I>
 {};
 
-// TODO - move this to the other, optional file?
+#if defined(BOOST_CONTAINER_STATIC_VECTOR_ENABLE_VECTORS_OPTIMIZATION) && !defined(BOOST_NO_EXCEPTIONS)
 
-#ifndef BOOST_NO_EXCEPTIONS
 template <typename Pointer>
-struct are_elements_contiguous< container_detail::vector_const_iterator<Pointer> > : boost::true_type
+struct are_elements_contiguous<
+ boost::container_detail::vector_const_iterator<Pointer>
+> : boost::true_type
 {};
 
 template <typename Pointer>
-struct are_elements_contiguous< container_detail::vector_iterator<Pointer> > : boost::true_type
+struct are_elements_contiguous<
+ boost::container_detail::vector_iterator<Pointer>
+> : boost::true_type
 {};
 
 #if defined(BOOST_DINKUMWARE_STDLIB)
@@ -113,29 +110,38 @@
 //{};
 
 #else // OTHER_STDLIB
+
 // TODO - add other iterators implementations
-#endif // OTHER_STDLIB
-#endif // BOOST_NO_EXCEPTIONS
+
+#endif // STDLIB
+
+#endif // BOOST_CONTAINER_STATIC_VECTOR_ENABLE_VECTORS_OPTIMIZATION && !BOOST_NO_EXCEPTIONS
+
+}}} // namespace boost::container::static_vector_detail
+
+#endif // !BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+namespace boost { namespace container { namespace static_vector_detail {
+
+// TODO
+// Does BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION checks have any sense?
+// Boost.MPL and Boost.Container might not be used but
+// Boost.Iterator also uses partial specialization
+// and in fact iterator_traits won't work if there is no partial specialization
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
 
 template <typename I, typename O>
 struct are_corresponding :
- boost::mpl::and_<
- boost::is_same<
- boost::remove_const<
- typename boost::iterator_value<I>::type
+ ::boost::mpl::and_<
+ ::boost::is_same<
+ ::boost::remove_const<
+ typename ::boost::iterator_value<I>::type
>,
- boost::remove_const<
- typename boost::iterator_value<O>::type
+ ::boost::remove_const<
+ typename ::boost::iterator_value<O>::type
>
>,
- /*boost::is_same<
- typename boost::iterator_traversal<I>::type,
- boost::random_access_traversal_tag
- >,
- boost::is_same<
- typename boost::iterator_traversal<O>::type,
- boost::random_access_traversal_tag
- >,*/
         are_elements_contiguous<I>,
         are_elements_contiguous<O>
>
@@ -483,10 +489,6 @@
 
 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
 
-template <typename I>
-struct are_elements_contiguous
-{};
-
 template <typename I, typename O>
 inline O copy(I first, I last, O dst)
 {

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-26 15:27:27 EST (Wed, 26 Dec 2012)
@@ -52,7 +52,7 @@
 
     template <typename V, std::size_t C, typename S>
     static void check_at(container::static_vector<V, C, S> const& v,
- typename container::static_vector<V, C, S>::size_type i)
+ typename container::static_vector<V, C, S>::size_type i)
     {
 #ifndef BOOST_NO_EXCEPTIONS
         if ( v.size() <= i )
@@ -64,7 +64,7 @@
 
     template <typename V, std::size_t C, typename S>
     static void check_operator_brackets(container::static_vector<V, C, S> const& v,
- typename container::static_vector<V, C, S>::size_type i)
+ typename container::static_vector<V, C, S>::size_type i)
     {
         BOOST_ASSERT_MSG(i < v.size(), "index out of bounds");
     }
@@ -212,7 +212,12 @@
 
     // basic
     template <std::size_t C, typename S>
- static_vector & operator=(BOOST_MOVE_COPY_ASSIGN_REF_3_TEMPL_ARGS(static_vector, value_type, C, S) other)
+// TEMPORARY WORKAROUND
+#if defined(BOOST_NO_RVALUE_REFERENCES)
+ static_vector & operator=(::boost::rv< static_vector<value_type, C, S> > const& other)
+#else
+ static_vector & operator=(static_vector<value_type, C, S> const& other)
+#endif
     {
         this->assign(other.begin(), other.end()); // 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