Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54876 - in sandbox/SOC/2009/fusion: . boost/fusion/adapted/detail/array boost/fusion/adapted/detail/boost_tuple boost/fusion/adapted/detail/mpl boost/fusion/adapted/detail/struct boost/fusion/algorithm/iteration boost/fusion/algorithm/iteration/detail boost/fusion/container/vector/detail libs/fusion/example/performance libs/fusion/test
From: mr.chr.schmidt_at_[hidden]
Date: 2009-07-10 20:51:12


Author: cschmidt
Date: 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
New Revision: 54876
URL: http://svn.boost.org/trac/boost/changeset/54876

Log:
fold bugfixes
Text files modified:
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/array/array_iterator.hpp | 11
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/boost_tuple/boost_tuple_iterator.hpp | 26 --
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/mpl/mpl_iterator.hpp | 48 +---
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/struct_iterator.hpp | 33 +-
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/fold.hpp | 379 ++++++++++++++++++++-------------------
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/fold.hpp | 46 ++--
   sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/vector_iterator.hpp | 6
   sandbox/SOC/2009/fusion/libs/fusion/example/performance/Jamfile | 2
   sandbox/SOC/2009/fusion/libs/fusion/example/performance/accumulate.cpp | 5
   sandbox/SOC/2009/fusion/libs/fusion/example/performance/inner_product2.cpp | 2
   sandbox/SOC/2009/fusion/libs/fusion/example/performance/sequence_efficiency.cpp | 25 +-
   sandbox/SOC/2009/fusion/libs/fusion/test/Jamfile | 14 -
   sandbox/SOC/2009/fusion/project-root.jam | 2
   13 files changed, 275 insertions(+), 324 deletions(-)

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/array/array_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/array/array_iterator.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/array/array_iterator.hpp 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
@@ -48,9 +48,9 @@
 
             typedef typename
                 detail::forward_as<
- typename it::array_type
+ ArrayRef
                   , typename detail::remove_reference<
- typename it::array_type
+ ArrayRef
>::type::value_type
>::type
             type;
@@ -65,12 +65,10 @@
         template <typename ItRef, typename N>
         struct advance
         {
- typedef typename detail::remove_reference<ItRef>::type it;
-
             typedef
                 array_iterator<
- typename it::array_type
- , it::index::value + N::value
+ ArrayRef
+ , Pos + N::value
>
             type;
 
@@ -100,7 +98,6 @@
         {};
 
         typedef mpl::int_<Pos> index;
- typedef ArrayRef array_type;
 
         template<typename OtherIt>
         array_iterator(OtherIt const& it)

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/boost_tuple/boost_tuple_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/boost_tuple/boost_tuple_iterator.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/boost_tuple/boost_tuple_iterator.hpp 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
@@ -24,9 +24,7 @@
         struct value_of
         {
             typedef typename
- detail::remove_reference<
- typename detail::remove_reference<ItRef>::type
- >::type::cons_type::head_type
+ detail::remove_reference<ConsRef>::type::head_type
             type;
         };
 
@@ -34,14 +32,10 @@
         struct deref
         {
             typedef typename
- detail::remove_reference<ItRef>::type
- it;
-
- typedef typename
                 detail::forward_as<
- typename it::cons_type
+ ConsRef
                   , typename detail::remove_reference<
- typename it::cons_type
+ ConsRef
>::type::head_type
>::type
             type;
@@ -56,16 +50,12 @@
         template <typename ItRef>
         struct next
         {
- typedef typename
- detail::remove_reference<ItRef>::type
- it;
-
             typedef
                 boost_tuple_iterator<
                     typename detail::forward_as<
- typename it::cons_type,
- typename detail::remove_reference<
- typename it::cons_type
+ ConsRef
+ , typename detail::remove_reference<
+ ConsRef
>::type::tail_type
>::type
>
@@ -81,9 +71,7 @@
         template <typename It1Ref, typename It2Ref>
         struct equal_to
           : is_same<
- typename detail::identity<
- typename detail::remove_reference<It1Ref>::type::cons_type
- >::type
+ typename detail::identity<ConsRef>::type
               , typename detail::identity<
                     typename detail::remove_reference<It2Ref>::type::cons_type
>::type

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/mpl/mpl_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/mpl/mpl_iterator.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/mpl/mpl_iterator.hpp 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
@@ -31,34 +31,20 @@
           , typename traits::category_of<It>::type
>
     {
- //cschmidt: void typedef to enable fast SFINAE in equal_to_impl.hpp!
- typedef void void_;
-
- typedef It it_type;
-
         template <typename ItRef>
         struct value_of
- : result_of::value_of<
- typename detail::remove_reference<ItRef>::type::it_type
- >
+ : result_of::value_of<It>
         {};
 
         template <typename It1Ref, typename It2Ref>
         struct equal_to
- : result_of::equal_to<
- typename detail::remove_reference<It1Ref>::type::it_type
- , It2Ref
- >
+ : result_of::equal_to<It, It2Ref>
         {};
 
         template <typename ItRef>
         struct deref
         {
- typedef typename
- detail::remove_reference<ItRef>::type::it_type
- it_type;
-
- typedef typename result_of::deref<it_type>::type type;
+ typedef typename result_of::deref<It>::type type;
 
             static type
             call(ItRef)
@@ -70,11 +56,7 @@
         template <typename ItRef>
         struct next
         {
- typedef typename
- detail::remove_reference<ItRef>::type::it_type
- it_type;
-
- typedef typename result_of::next<it_type>::type type;
+ typedef typename result_of::next<It>::type type;
 
             static type
             call(ItRef)
@@ -86,11 +68,7 @@
         template <typename ItRef>
         struct prior
         {
- typedef typename
- detail::remove_reference<ItRef>::type::it_type
- it_type;
-
- typedef typename result_of::prior<it_type>::type type;
+ typedef typename result_of::prior<It>::type type;
 
             static type
             call(ItRef)
@@ -102,11 +80,7 @@
         template <typename ItRef, typename N>
         struct advance
         {
- typedef typename
- detail::remove_reference<ItRef>::type::it_type
- it_type;
-
- typedef typename fusion::result_of::advance<it_type,N>::type type;
+ typedef typename fusion::result_of::advance<It,N>::type type;
 
             static type
             call(ItRef)
@@ -117,12 +91,12 @@
 
         template <typename It1Ref, typename It2Ref>
         struct distance
- : result_of::distance<
- typename detail::remove_reference<It1Ref>::type::it_type
- , It2Ref
- >
-
+ : result_of::distance<It, It2Ref>
         {};
+
+ //cschmidt: void typedef to enable fast SFINAE in equal_to_impl.hpp!
+ typedef void void_;
+ typedef It it_type;
     };
 }}
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/struct_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/struct_iterator.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/struct_iterator.hpp 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
@@ -24,47 +24,45 @@
 {
     struct random_access_traversal_tag;
 
- template <typename SeqRef, int N>
+ template <typename SeqRef, int Pos>
     struct struct_iterator
- : iterator_facade<struct_iterator<SeqRef, N>, random_access_traversal_tag>
+ : iterator_facade<struct_iterator<SeqRef, Pos>, random_access_traversal_tag>
     {
         //BOOST_FUSION_INDEX_CHECK(N,struct_size<SeqRef>::value);
 
+ typedef typename detail::identity<SeqRef>::type identity_struct;
+
         template <typename ItRef>
         struct value_of
- : extension::struct_member<SeqRef, N>
+ : extension::struct_member<identity_struct, Pos>
         {};
 
         template <typename ItRef>
         struct deref
         {
- typedef typename detail::identity<SeqRef>::type identity_struct;
-
             typedef typename
                 detail::forward_as<
                     SeqRef
- , typename extension::struct_member<identity_struct, N>::type
+ , typename extension::struct_member<
+ identity_struct
+ , Pos
+ >::type
>::type
             type;
 
             static type
             call(ItRef it)
             {
- return extension::struct_member<identity_struct, N>::call(
+ return extension::struct_member<identity_struct, Pos>::call(
                         *it.struct_);
             }
         };
 
- template <typename ItRef, typename N_>
+ template <typename ItRef, typename N>
         struct advance
         {
- typedef typename detail::remove_reference<ItRef>::type it;
-
             typedef
- struct_iterator<
- typename it::struct_type
- , it::index::value + N_::value
- >
+ struct_iterator<SeqRef, Pos + N::value>
             type;
 
             static type
@@ -74,9 +72,6 @@
             }
         };
 
- typedef mpl::int_<N> index;
- typedef SeqRef struct_type;
-
         template <typename ItRef>
         struct next
           : advance<ItRef, mpl::int_<1> >
@@ -90,12 +85,14 @@
         template <typename It1Ref, typename It2Ref>
         struct distance
           : mpl::minus<
- typename detail::remove_reference<It2Ref>::type::index
+ mpl::int_<Pos>
               , typename detail::remove_reference<It1Ref>::type::index
>
         {
         };
 
+ typedef mpl::int_<Pos> index;
+
         template<typename OtherIt>
         struct_iterator(BOOST_FUSION_R_ELSE_CLREF(OtherIt) it)
           : struct_(it.struct_)

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/fold.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/fold.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/fold.hpp 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
@@ -19,202 +19,207 @@
 #include <boost/fusion/iterator/next.hpp>
 #include <boost/fusion/support/result_of.hpp>
 
+#include <boost/mpl/eval_if.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/apply.hpp>
 #include <boost/mpl/identity.hpp>
 
-namespace boost { namespace fusion
+namespace boost { namespace fusion { namespace detail
 {
- namespace detail
+ template<int N>
+ struct unrolled_fold
     {
- template <typename ItRef, typename StateRef, typename FRef>
- struct fold_apply
- : support::result_of<
- FRef(
- typename result_of::deref<ItRef>::type
- , StateRef
- )
- >
- {};
-
- template<typename It0Ref, typename StateRef, typename FRef, int N>
- struct result_of_unrolled_fold;
-
- template<int N>
- struct unrolled_fold
- {
- template<typename It0, typename State, typename F>
- static typename
- result_of_unrolled_fold<
- It0 const&
- , BOOST_FUSION_R_ELSE_CLREF(State)
- , BOOST_FUSION_R_ELSE_LREF(F)
- , N
- >::type
- call(It0 const& it0,
- BOOST_FUSION_R_ELSE_CLREF(State) state,
- BOOST_FUSION_R_ELSE_LREF(F) f)
- {
- typedef typename result_of::next<It0 const&>::type It1;
- It1 it1 = fusion::next(it0);
- typedef typename result_of::next<It1&>::type It2;
- It2 it2 = fusion::next(it1);
- typedef typename result_of::next<It2&>::type It3;
- It3 it3 = fusion::next(it2);
-
- return unrolled_fold<N-4>::call(
- fusion::next(it3),
- f(fusion::deref(it3),
- f(fusion::deref(it2),
- f(fusion::deref(it1),
- f(fusion::deref(it0),
- BOOST_FUSION_FORWARD(State,state)
- )
+ template<typename Result,typename It0, typename State, typename F>
+ static Result
+ call(It0 const& it0,
+ BOOST_FUSION_R_ELSE_CLREF(State) state,
+ BOOST_FUSION_R_ELSE_LREF(F) f)
+ {
+ typedef typename result_of::next<It0 const&>::type It1;
+ It1 it1 = fusion::next(it0);
+ typedef typename result_of::next<It1&>::type It2;
+ It2 it2 = fusion::next(it1);
+ typedef typename result_of::next<It2&>::type It3;
+ It3 it3 = fusion::next(it2);
+
+ return unrolled_fold<N-4>::template call<Result>(
+ fusion::next(it3),
+ f(fusion::deref(it3),
+ f(fusion::deref(it2),
+ f(fusion::deref(it1),
+ f(fusion::deref(it0),
+ BOOST_FUSION_FORWARD(State,state)
                                 )
                             )
- ),
- BOOST_FUSION_FORWARD(F,f));
- }
- };
-
- template<>
- struct unrolled_fold<3>
- {
- template<typename It0, typename State, typename F>
- static typename
- result_of_unrolled_fold<
- It0 const&
- , BOOST_FUSION_R_ELSE_CLREF(State)
- , BOOST_FUSION_R_ELSE_LREF(F)
- , 3>::type
- call(It0 const& it0,
- BOOST_FUSION_R_ELSE_CLREF(State) state,
- BOOST_FUSION_R_ELSE_LREF(F) f)
- {
- typedef typename result_of::next<It0 const&>::type It1;
- It1 it1 = fusion::next(it0);
- typedef typename result_of::next<It1&>::type It2;
- It2 it2 = fusion::next(it1);
+ )
+ ),
+ BOOST_FUSION_FORWARD(F,f));
+ }
+ };
 
- return f(fusion::deref(it2),
- f(fusion::deref(it1),
- f(
- fusion::deref(it0),
- BOOST_FUSION_FORWARD(State,state)
- )
+ template<>
+ struct unrolled_fold<3>
+ {
+ template<typename Result,typename It0, typename State, typename F>
+ static Result
+ call(It0 const& it0,
+ BOOST_FUSION_R_ELSE_CLREF(State) state,
+ BOOST_FUSION_R_ELSE_LREF(F) f)
+ {
+ typedef typename result_of::next<It0 const&>::type It1;
+ It1 it1 = fusion::next(it0);
+ typedef typename result_of::next<It1&>::type It2;
+ It2 it2 = fusion::next(it1);
+
+ return f(fusion::deref(it2),
+ f(fusion::deref(it1),
+ f(
+ fusion::deref(it0),
+ BOOST_FUSION_FORWARD(State,state)
                             )
- );
- }
- };
-
- template<>
- struct unrolled_fold<2>
- {
- template<typename It0, typename State, typename F>
- static typename
- result_of_unrolled_fold<
- It0 const&
- , BOOST_FUSION_R_ELSE_CLREF(State)
- , BOOST_FUSION_R_ELSE_LREF(F)
- , 2
- >::type
- call(It0 const& it0,
- BOOST_FUSION_R_ELSE_CLREF(State) state,
- BOOST_FUSION_R_ELSE_LREF(F) f)
- {
- return f(fusion::deref(fusion::next(it0)),
- f(fusion::deref(it0),
- BOOST_FUSION_FORWARD(State,state)));
- }
- };
-
- template<>
- struct unrolled_fold<1>
- {
- template<typename It0, typename State, typename F>
- static typename
- result_of_unrolled_fold<
- It0 const&
- , BOOST_FUSION_R_ELSE_CLREF(State)
- , BOOST_FUSION_R_ELSE_LREF(F)
- , 1
- >::type
- call(It0 const& it0,
- BOOST_FUSION_R_ELSE_CLREF(State) state,
- BOOST_FUSION_R_ELSE_LREF(F) f)
- {
- return f(fusion::deref(it0), BOOST_FUSION_FORWARD(State,state));
- }
- };
-
- template<>
- struct unrolled_fold<0>
- {
- template<typename It0, typename State, typename F>
- static BOOST_FUSION_R_ELSE_CLREF(State)
- call(It0 const&,
- BOOST_FUSION_R_ELSE_CLREF(State) state,
- BOOST_FUSION_R_ELSE_LREF(F))
- {
- return state;
- }
- };
-
- template<typename It0, typename StateRef, typename FRef, int N>
- struct result_of_unrolled_fold
- {
- typedef typename result_of::next<It0>::type It1;
- typedef typename result_of::next<It1>::type It2;
- typedef typename result_of::next<It2>::type It3;
- typedef typename result_of::next<It3>::type It4;
- typedef typename fold_apply<It0, StateRef, FRef>::type Rest1;
- typedef typename fold_apply<It1, Rest1, FRef>::type Rest2;
- typedef typename fold_apply<It2, Rest2, FRef>::type Rest3;
- typedef typename fold_apply<It3, Rest3, FRef>::type Rest4;
-
- typedef typename
- result_of_unrolled_fold<It4, Rest4, FRef, N-4>::type
- type;
- };
-
- template<typename It0Ref, typename StateRef, typename FRef>
- struct result_of_unrolled_fold<It0Ref, StateRef, FRef, 3>
- {
- typedef typename result_of::next<It0Ref>::type It1;
- typedef typename result_of::next<It1>::type It2;
- typedef typename fold_apply<It0Ref, StateRef, FRef>::type Rest;
- typedef typename fold_apply<It1, Rest, FRef>::type Rest2;
-
- typedef typename
- fold_apply<It2, Rest2, FRef>::type
- type;
- };
-
- template<typename It0Ref, typename StateRef, typename FRef>
- struct result_of_unrolled_fold<It0Ref, StateRef, FRef, 2>
- {
- typedef typename result_of::next<It0Ref>::type It1;
- typedef typename fold_apply<It0Ref, StateRef, FRef>::type Rest;
-
- typedef typename
- fold_apply<It1, Rest, FRef>::type
- type;
- };
-
- template<typename It0Ref, typename StateRef, typename FRef>
- struct result_of_unrolled_fold<It0Ref, StateRef, FRef, 1>
- {
- typedef typename
- fold_apply<It0Ref, StateRef, FRef>::type
- type;
- };
-
- template<typename It0Ref, typename StateRef, typename FRef>
- struct result_of_unrolled_fold<It0Ref, StateRef, FRef, 0>
- {
- typedef StateRef type;
- };
- }
-}}
+ )
+ );
+ }
+ };
+
+ template<>
+ struct unrolled_fold<2>
+ {
+ template<typename Result,typename It0, typename State, typename F>
+ static Result
+ call(It0 const& it0,
+ BOOST_FUSION_R_ELSE_CLREF(State) state,
+ BOOST_FUSION_R_ELSE_LREF(F) f)
+ {
+ return f(fusion::deref(fusion::next(it0)),
+ f(fusion::deref(it0),
+ BOOST_FUSION_FORWARD(State,state)));
+ }
+ };
+
+ template<>
+ struct unrolled_fold<1>
+ {
+ template<typename Result,typename It0, typename State, typename F>
+ static Result
+ call(It0 const& it0,
+ BOOST_FUSION_R_ELSE_CLREF(State) state,
+ BOOST_FUSION_R_ELSE_LREF(F) f)
+ {
+ return f(fusion::deref(it0), BOOST_FUSION_FORWARD(State,state));
+ }
+ };
+
+ template<>
+ struct unrolled_fold<0>
+ {
+ template<typename Result,typename It0, typename State, typename F>
+ static Result
+ call(It0 const&,
+ BOOST_FUSION_R_ELSE_CLREF(State) state,
+ BOOST_FUSION_R_ELSE_LREF(F))
+ {
+ return state;
+ }
+ };
+
+ template <typename It, typename StateRef, typename FRef>
+ struct fold_apply
+ : support::result_of<
+ FRef(
+ typename result_of::deref<It>::type
+ , StateRef
+ )
+ >
+ {};
+
+ template<typename It0, typename StateRef, typename FRef, int N>
+ struct result_of_unrolled_fold
+ {
+ typedef typename fold_apply<It0, StateRef, FRef>::type rest1;
+ typedef typename result_of::next<It0>::type it1;
+ typedef typename fold_apply<it1, BOOST_FUSION_R_ELSE_CLREF(rest1), FRef>::type rest2;
+ typedef typename result_of::next<it1>::type it2;
+ typedef typename fold_apply<it2, BOOST_FUSION_R_ELSE_CLREF(rest2), FRef>::type rest3;
+ typedef typename result_of::next<it2>::type it3;
+ typedef typename fold_apply<it3, BOOST_FUSION_R_ELSE_CLREF(rest3), FRef>::type rest4;
+ typedef typename result_of::next<it3>::type it4;
+
+ typedef typename
+ mpl::eval_if_c<
+ !(N-4)
+ , mpl::identity<rest4>
+ , result_of_unrolled_fold<
+ it4
+ , BOOST_FUSION_R_ELSE_CLREF(rest4)
+ , FRef
+ , N-4
+ >
+ >::type
+ type;
+ };
+
+ template<typename It0, typename StateRef, typename FRef>
+ struct result_of_unrolled_fold<It0, StateRef, FRef, 3>
+ {
+ typedef typename fold_apply<It0, StateRef, FRef>::type rest1;
+ typedef typename result_of::next<It0>::type it1;
+ typedef typename fold_apply<it1, BOOST_FUSION_R_ELSE_CLREF(rest1), FRef>::type rest2;
+ typedef typename result_of::next<it1>::type it2;
+
+ typedef typename
+ fold_apply<it2, BOOST_FUSION_R_ELSE_CLREF(rest2), FRef>::type
+ type;
+ };
+
+ template<typename It0, typename StateRef, typename FRef>
+ struct result_of_unrolled_fold<It0, StateRef, FRef, 2>
+ {
+ typedef typename fold_apply<It0, StateRef, FRef>::type rest;
+ typedef typename result_of::next<It0>::type it1;
+
+ typedef typename
+ fold_apply<it1, BOOST_FUSION_R_ELSE_CLREF(rest), FRef>::type
+ type;
+ };
+
+ template<typename It0, typename StateRef, typename FRef>
+ struct result_of_unrolled_fold<It0, StateRef, FRef, 1>
+ {
+ typedef typename
+ fold_apply<It0, BOOST_FUSION_R_ELSE_CLREF(StateRef), FRef>::type
+ type;
+ };
+
+ template<int SeqSize, typename It0, typename StateRef, typename FRef>
+ struct fold_impl
+ : result_of_unrolled_fold<It0, StateRef, FRef, SeqSize>
+ {
+ typedef typename
+ result_of_unrolled_fold<It0, StateRef, FRef, SeqSize>::type
+ type;
+
+ static type
+ call(It0 const& it0, StateRef state, FRef f)
+ {
+ return unrolled_fold<SeqSize>::template call<type>(
+ it0,
+ BOOST_FUSION_FORWARD(StateRef,state),
+ BOOST_FUSION_FORWARD(FRef,f));
+ }
+ };
+
+ template<typename It0, typename StateRef, typename FRef>
+ struct fold_impl<0,It0,StateRef,FRef>
+ {
+ typedef StateRef type;
+
+ static StateRef
+ call(It0 const&, StateRef state, FRef)
+ {
+ return state;
+ }
+ };
+}}}
 
 #endif

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/fold.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/fold.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/fold.hpp 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
@@ -24,35 +24,37 @@
     {
         template <typename Seq, typename State, typename F>
         struct fold
- : detail::result_of_unrolled_fold<
- typename result_of::begin<Seq>::type
- , typename detail::add_lref<State>::type
- , typename detail::add_lref<F>::type
- , result_of::size<Seq>::value
- >
- {};
+ {
+ typedef
+ detail::fold_impl<
+ result_of::size<Seq>::value
+ , typename result_of::begin<Seq>::type
+ , typename detail::add_lref<State>::type
+ , typename detail::add_lref<F>::type
+ >
+ gen;
+
+ typedef typename gen::type type;
+ };
     }
 
     template <typename Seq, typename State, typename F>
- inline typename result_of::fold<
- BOOST_FUSION_R_ELSE_LREF(Seq)
- , BOOST_FUSION_R_ELSE_CLREF(State)
- , BOOST_FUSION_R_ELSE_LREF(F)
- >::type
+ inline typename
+ result_of::fold<
+ BOOST_FUSION_R_ELSE_LREF(Seq)
+ , BOOST_FUSION_R_ELSE_CLREF(State)
+ , BOOST_FUSION_R_ELSE_LREF(F)
+ >::type
     fold(BOOST_FUSION_R_ELSE_LREF(Seq) seq,
          BOOST_FUSION_R_ELSE_CLREF(State) state,
          BOOST_FUSION_R_ELSE_LREF(F) f)
     {
- typedef
- detail::unrolled_fold<
- result_of::size<BOOST_FUSION_R_ELSE_LREF(Seq)>::value
- >
- gen;
-
- return gen::call(
- fusion::begin(seq)
- , BOOST_FUSION_FORWARD(State,state)
- , BOOST_FUSION_FORWARD(F,f));
+ return
+ result_of::fold<
+ BOOST_FUSION_R_ELSE_LREF(Seq)
+ , BOOST_FUSION_R_ELSE_CLREF(State)
+ , BOOST_FUSION_R_ELSE_LREF(F)
+ >::gen::call(fusion::begin(seq), state, f);
     }
 }}
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/vector_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/vector_iterator.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/container/vector/detail/vector_iterator.hpp 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
@@ -20,11 +20,11 @@
     struct vector_iterator_tag;
     struct random_access_traversal_tag;
 
- template <typename VecRef, int N>
+ template <typename VecRef, int Pos>
     struct vector_iterator
- : iterator_base<vector_iterator<VecRef, N> >
+ : iterator_base<vector_iterator<VecRef, Pos> >
     {
- typedef mpl::int_<N> index;
+ typedef mpl::int_<Pos> index;
         typedef VecRef vector;
         typedef vector_iterator_tag fusion_tag;
         typedef random_access_traversal_tag category;

Modified: sandbox/SOC/2009/fusion/libs/fusion/example/performance/Jamfile
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/performance/Jamfile (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/performance/Jamfile 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
@@ -16,5 +16,5 @@
 
 exe sequence_efficiency : sequence_efficiency.cpp ;
 
-exe functional : functional.cpp ;
+#exe functional : functional.cpp ;
 

Modified: sandbox/SOC/2009/fusion/libs/fusion/example/performance/accumulate.cpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/performance/accumulate.cpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/performance/accumulate.cpp 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
@@ -249,9 +249,8 @@
     {
         template<typename Lhs, typename Rhs>
         struct result
- {
- typedef Rhs type;
- };
+ : boost::fusion::detail::remove_reference<Rhs>
+ {};
         
         template<typename Lhs, typename Rhs>
         typename result<Lhs,Rhs>::type

Modified: sandbox/SOC/2009/fusion/libs/fusion/example/performance/inner_product2.cpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/performance/inner_product2.cpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/performance/inner_product2.cpp 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
@@ -121,7 +121,7 @@
 
         template<typename Lhs, typename Rhs>
         struct result<poly_combine(Lhs, Rhs)>
- : boost::remove_reference<Rhs>
+ : boost::fusion::detail::remove_reference<Rhs>
         {};
         
         template<typename Lhs, typename Rhs>

Modified: sandbox/SOC/2009/fusion/libs/fusion/example/performance/sequence_efficiency.cpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/performance/sequence_efficiency.cpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/performance/sequence_efficiency.cpp 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
@@ -6,6 +6,7 @@
 ==============================================================================*/
 #include "measure.hpp"
 
+//TODO: BOOST_FUSION_MAX
 #define FUSION_MAX_LIST_SIZE 30
 #define FUSION_MAX_VECTOR_SIZE 30
 
@@ -66,7 +67,7 @@
 
         template<typename Lhs, typename Rhs>
         struct result<poly_add(Lhs, Rhs)>
- : boost::remove_reference<Lhs>
+ : boost::remove_reference<Lhs>
         {};
 
         template<typename Lhs, typename Rhs>
@@ -81,7 +82,7 @@
     struct accumulator
     {
         accumulator()
- : sum()
+ : sum()
         {}
         
         template <typename Sequence>
@@ -98,7 +99,7 @@
     struct plain_accumulator
     {
         plain_accumulator()
- : sum()
+ : sum()
         {}
         
         template <typename X>
@@ -166,7 +167,9 @@
>
     lmedium(BOOST_PP_ENUM(10, INIT, _));
 
- vector<
+ //TODO cschmidt: uncomment this once mpl got variadic templates
+ //and we are not limited to BOOST_MPL_MAX_VECTOR_SIZE any more!
+ /*vector<
         int, int, int, int, int, int, int, int, int, int
       , int, int, int, int, int, int, int, int, int, int
       , int, int, int, int, int, int, int, int, int, int
@@ -178,7 +181,7 @@
       , int, int, int, int, int, int, int, int, int, int
       , int, int, int, int, int, int, int, int, int, int
>
- lbig(BOOST_PP_ENUM(30, INIT, _));
+ lbig(BOOST_PP_ENUM(30, INIT, _));*/
 
     // first decide how many repetitions to measure
     long repeats = 100;
@@ -194,8 +197,8 @@
         test::hammer<accumulator<int> >(lsmall, repeats);
         test::hammer<accumulator<int> >(vmedium, repeats);
         test::hammer<accumulator<int> >(lmedium, repeats);
- test::hammer<accumulator<int> >(vbig, repeats);
- test::hammer<accumulator<int> >(lbig, repeats);
+ //test::hammer<accumulator<int> >(vbig, repeats);
+ //test::hammer<accumulator<int> >(lbig, repeats);
 
         measured = time.elapsed();
     }
@@ -220,8 +223,8 @@
     check(lsmall, "small list accumulated result: ");
     check(vmedium, "medium vector accumulated result: ");
     check(lmedium, "medium list accumulated result: ");
- check(vbig, "big vector accumulated result: ");
- check(lbig, "big list accumulated result: ");
+ //check(vbig, "big vector accumulated result: ");
+ //check(lbig, "big list accumulated result: ");
 
     std::cout
         << "-------------------------------------------------------------------"
@@ -231,8 +234,8 @@
     measure(lsmall, "small list time: ", repeats, base_time);
     measure(vmedium, "medium vector time: ", repeats, base_time);
     measure(lmedium, "medium list time: ", repeats, base_time);
- measure(vbig, "big vector time: ", repeats, base_time);
- measure(lbig, "big list time: ", repeats, base_time);
+ //measure(vbig, "big vector time: ", repeats, base_time);
+ //measure(lbig, "big list time: ", repeats, base_time);
 
     std::cout
         << "-------------------------------------------------------------------"

Modified: sandbox/SOC/2009/fusion/libs/fusion/test/Jamfile
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/test/Jamfile (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/Jamfile 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
@@ -112,17 +112,3 @@
 
     ;
 }
-
-{
- # Text for extension features, must be explicitly specified on the command line to be run
- # TODO these are not in a test-suite because currently test-suites cannot be marked "explicit"
-
-# run algorithm/ext_/for_each_s.cpp ;
-# explicit for_each_s ;
-
-# run algorithm/ext_/find_if_s.cpp ;
-# explicit find_if_s ;
-
-# run sequence/ext_/iterator_range_s.cpp ;
-# explicit iterator_range_s ;
-}

Modified: sandbox/SOC/2009/fusion/project-root.jam
==============================================================================
--- sandbox/SOC/2009/fusion/project-root.jam (original)
+++ sandbox/SOC/2009/fusion/project-root.jam 2009-07-10 20:51:10 EDT (Fri, 10 Jul 2009)
@@ -25,5 +25,5 @@
 
 build-project libs/fusion/doc ;
 #build-project libs/fusion/example/extension ;
-#build-project libs/fusion/example/performance ;
+build-project libs/fusion/example/performance ;
 build-project libs/fusion/test ;
\ No newline at end of file


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