Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82669 - trunk/boost/fusion/container/deque
From: joel_at_[hidden]
Date: 2013-02-06 20:23:42


Author: djowel
Date: 2013-01-31 10:31:28 EST (Thu, 31 Jan 2013)
New Revision: 82669
URL: http://svn.boost.org/trac/boost/changeset/82669

Log:
Better deque conversion
Text files modified:
   trunk/boost/fusion/container/deque/convert.hpp | 29 ++++++++++++++++++++++++-----
   1 files changed, 24 insertions(+), 5 deletions(-)

Modified: trunk/boost/fusion/container/deque/convert.hpp
==============================================================================
--- trunk/boost/fusion/container/deque/convert.hpp (original)
+++ trunk/boost/fusion/container/deque/convert.hpp 2013-01-31 10:31:28 EST (Thu, 31 Jan 2013)
@@ -43,6 +43,21 @@
             }
         };
 
+ template <typename T, typename Rest>
+ struct push_front_deque;
+
+ template <typename T, typename ...Rest>
+ struct push_front_deque<T, deque<Rest...>>
+ {
+ typedef deque<T, Rest...> type;
+
+ static type
+ call(T const& first, deque<Rest...> const& rest)
+ {
+ return type(front_extended_deque<deque<Rest...>, T>(rest, first));
+ }
+ };
+
         template <typename First, typename Last>
         struct build_deque<First, Last, false>
         {
@@ -50,16 +65,19 @@
                 build_deque<typename result_of::next<First>::type, Last>
             next_build_deque;
 
- typedef front_extended_deque<
- typename next_build_deque::type
- , typename result_of::value_of<First>::type>
- type;
+ typedef push_front_deque<
+ typename result_of::value_of<First>::type
+ , typename next_build_deque::type>
+ push_front;
+
+ typedef typename push_front::type type;
 
             static type
             call(First const& f, Last const& l)
             {
                 typename result_of::value_of<First>::type v = *f;
- return type(next_build_deque::call(fusion::next(f), l), v);
+ return push_front::call(
+ v, next_build_deque::call(fusion::next(f), l));
             }
         };
     }
@@ -102,6 +120,7 @@
 #include <boost/fusion/sequence/intrinsic/begin.hpp>
 #include <boost/fusion/sequence/intrinsic/size.hpp>
 #include <boost/fusion/container/deque/detail/pp_as_deque.hpp>
+#include <boost/fusion/container/deque/front_extended_deque.hpp>
 
 namespace boost { namespace fusion
 {


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