Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82109 - in sandbox/static_vector: boost/container/detail examples
From: adam.wulkiewicz_at_[hidden]
Date: 2012-12-19 22:29:41


Author: awulkiew
Date: 2012-12-19 22:29:40 EST (Wed, 19 Dec 2012)
New Revision: 82109
URL: http://svn.boost.org/trac/boost/changeset/82109

Log:
added optimization for libstdc++ and libc++(currently commented out) vector iterator
Text files modified:
   sandbox/static_vector/boost/container/detail/static_vector_util.hpp | 28 +++++++++++++++++++++++++---
   sandbox/static_vector/examples/times.cpp | 2 ++
   2 files changed, 27 insertions(+), 3 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 22:29:40 EST (Wed, 19 Dec 2012)
@@ -60,15 +60,37 @@
 #if defined(_MSC_VER)
 
 template <typename T>
-struct are_elements_contiguous< std::_Vector_const_iterator<T> > : boost::true_type
+struct are_elements_contiguous<
+ std::_Vector_const_iterator<T>
+> : boost::true_type
 {};
 
 template <typename T>
-struct are_elements_contiguous< std::_Vector_iterator<T> > : boost::true_type
+struct are_elements_contiguous<
+ std::_Vector_iterator<T>
+> : boost::true_type
 {};
 
-// TODO - add other iterators implementations
+#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
+
+template <typename P, typename T, typename A>
+struct are_elements_contiguous<
+ __gnu_cxx::__normal_iterator<P, std::vector<T, A> >
+> : boost::true_type
+{};
+
+#elif defined(_LIBCPP_VERSION)
 
+// TODO - test it first
+
+//template <typename P>
+//struct are_elements_contiguous<
+// __wrap_iter<P>
+//> : boost::true_type
+//{};
+
+#else
+// TODO - add other iterators implementations
 #endif
 
 template <typename I, typename O>

Modified: sandbox/static_vector/examples/times.cpp
==============================================================================
--- sandbox/static_vector/examples/times.cpp (original)
+++ sandbox/static_vector/examples/times.cpp 2012-12-19 22:29:40 EST (Wed, 19 Dec 2012)
@@ -49,6 +49,8 @@
     return dummy;
 };
 
+#include <vector>
+
 int main()
 {
     size_t count = 2000000;


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