Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54782 - in sandbox/SOC/2009/fusion: boost/fusion/algorithm/iteration/detail boost/fusion/algorithm/query boost/fusion/algorithm/query/detail boost/fusion/algorithm/transformation boost/fusion/algorithm/transformation/detail boost/fusion/container/list boost/fusion/container/map boost/fusion/container/map/detail/pp boost/fusion/support/detail/pp libs/fusion/example/extension libs/fusion/example/test
From: mr.chr.schmidt_at_[hidden]
Date: 2009-07-07 17:45:49


Author: cschmidt
Date: 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
New Revision: 54782
URL: http://svn.boost.org/trac/boost/changeset/54782

Log:
the algorithm helper classes no honor the r- and lvalue-ness of their arguments.
Removed:
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/any.hpp
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/replace.hpp
Text files modified:
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/fold.hpp | 2
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/for_each.hpp | 33 ++++----
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/all.hpp | 15 ++-
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/any.hpp | 33 ++++++--
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/count.hpp | 2
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/count_if.hpp | 7 -
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/all.hpp | 146 ++++++++++++++++++---------------------
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/count.hpp | 5
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/find_if.hpp | 6 +
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/replace_if.hpp | 45 +++++++-----
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/erase.hpp | 1
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/remove.hpp | 2
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace.hpp | 63 ++++++++++++----
   sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace_if.hpp | 10 +-
   sandbox/SOC/2009/fusion/boost/fusion/container/list/cons_iterator.hpp | 1
   sandbox/SOC/2009/fusion/boost/fusion/container/map/detail/pp/lookup_key.hpp | 1
   sandbox/SOC/2009/fusion/boost/fusion/container/map/map.hpp | 1
   sandbox/SOC/2009/fusion/boost/fusion/support/detail/pp/void.hpp | 3
   sandbox/SOC/2009/fusion/libs/fusion/example/extension/example_struct_iterator.hpp | 1
   sandbox/SOC/2009/fusion/libs/fusion/example/test/main.cpp | 19 ++++
   20 files changed, 221 insertions(+), 175 deletions(-)

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-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -37,7 +37,7 @@
>
         {};
 
- template<typename It0Ref, typename State, typename F, int N>
+ template<typename It0Ref, typename StateRef, typename FRef, int N>
         struct result_of_unrolled_fold;
 
         template<int N>

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/for_each.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/for_each.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/iteration/detail/for_each.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -26,18 +26,16 @@
         template<typename It0, typename F>
         static void call(It0 const& it0, BOOST_FUSION_R_ELSE_LREF(F) f)
         {
- f(fusion::deref(it0));
-
- typedef typename result_of::next<It0>::type It1;
+ typedef typename result_of::next<It0 const&>::type It1;
             It1 it1(fusion::next(it0));
- f(fusion::deref(it1));
-
- typedef typename result_of::next<It1>::type It2;
+ typedef typename result_of::next<It1&>::type It2;
             It2 it2(fusion::next(it1));
- f(fusion::deref(it2));
-
- typedef typename result_of::next<It2>::type It3;
+ typedef typename result_of::next<It2&>::type It3;
             It3 it3(fusion::next(it2));
+
+ f(fusion::deref(it0));
+ f(fusion::deref(it1));
+ f(fusion::deref(it2));
             f(fusion::deref(it3));
 
             for_each_unrolled<N-4>::call(
@@ -52,14 +50,13 @@
         template<typename It0, typename F>
         static void call(It0 const& it0, BOOST_FUSION_R_ELSE_LREF(F) f)
         {
- f(fusion::deref(it0));
-
- typedef typename result_of::next<It0>::type It1;
+ typedef typename result_of::next<It0 const&>::type It1;
             It1 it1(fusion::next(it0));
- f(fusion::deref(it1));
-
- typedef typename result_of::next<It1>::type It2;
+ typedef typename result_of::next<It1&>::type It2;
             It2 it2(fusion::next(it1));
+
+ f(fusion::deref(it0));
+ f(fusion::deref(it1));
             f(fusion::deref(it2));
         }
     };
@@ -70,10 +67,10 @@
         template<typename It0, typename F>
         static void call(It0 const& it0, BOOST_FUSION_R_ELSE_LREF(F) f)
         {
- f(fusion::deref(it0));
-
- typedef typename result_of::next<It0>::type It1;
+ typedef typename result_of::next<It0 const&>::type It1;
             It1 it1(fusion::next(it0));
+
+ f(fusion::deref(it0));
             f(fusion::deref(it1));
         }
     };

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/all.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/all.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/all.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -9,7 +9,8 @@
 #ifndef BOOST_FUSION_ALGORITHM_QUERY_ALL_HPP
 #define BOOST_FUSION_ALGORITHM_QUERY_ALL_HPP
 
-#include <boost/fusion/support/category_of.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
 #include <boost/fusion/support/ref.hpp>
 
 #include <boost/fusion/algorithm/query/detail/all.hpp>
@@ -29,12 +30,12 @@
     inline bool
     all(BOOST_FUSION_R_ELSE_LREF(Seq) seq, BOOST_FUSION_R_ELSE_LREF(F) f)
     {
- return detail::all(
- BOOST_FUSION_FORWARD(Seq,seq),
- BOOST_FUSION_FORWARD(F,f),
- typename traits::category_of<
- BOOST_FUSION_R_ELSE_LREF(Seq)
- >::type());
+ return
+ detail::unrolled_all<
+ result_of::size<BOOST_FUSION_R_ELSE_LREF(Seq)>::value
+ >::call(
+ fusion::begin(BOOST_FUSION_FORWARD(Seq,seq))
+ , BOOST_FUSION_FORWARD(F,f));
     }
 }}
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/any.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/any.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/any.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -10,13 +10,33 @@
 #ifndef BOOST_FUSION_ALGORITHM_QUERY_ANY_HPP
 #define BOOST_FUSION_ALGORITHM_QUERY_ANY_HPP
 
-#include <boost/fusion/support/category_of.hpp>
+#include <boost/fusion/algorithm/query/all.hpp>
 #include <boost/fusion/support/ref.hpp>
 
-#include <boost/fusion/algorithm/query/detail/any.hpp>
-
 namespace boost { namespace fusion
 {
+ namespace detail
+ {
+ template<typename FRef>
+ struct any_helper
+ {
+ typedef bool result_type;
+
+ any_helper(FRef f)
+ : f(f)
+ {}
+
+ template<typename E>
+ inline bool
+ operator()(BOOST_FUSION_R_ELSE_LREF(E) e)
+ {
+ return !f(BOOST_FUSION_FORWARD(E,e));
+ }
+
+ FRef f;
+ };
+ }
+
     namespace result_of
     {
         template <typename Seq, typename F>
@@ -30,12 +50,9 @@
     inline bool
     any(BOOST_FUSION_R_ELSE_LREF(Seq) seq, BOOST_FUSION_R_ELSE_LREF(F) f)
     {
- return detail::any(
+ return !all(
                 BOOST_FUSION_FORWARD(Seq,seq),
- BOOST_FUSION_FORWARD(F,f),
- typename traits::category_of<
- BOOST_FUSION_R_ELSE_LREF(Seq)
- >::type());
+ detail::any_helper<BOOST_FUSION_R_ELSE_LREF(F)>(f));
     }
 }}
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/count.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/count.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/count.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -31,7 +31,7 @@
     {
         return fusion::count_if(
                 BOOST_FUSION_FORWARD(Seq,seq),
- detail::count_compare<BOOST_FUSION_R_ELSE_LREF(T)>(x));
+ detail::count_helper<BOOST_FUSION_R_ELSE_LREF(T)>(x));
     }
 }}
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/count_if.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/count_if.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/count_if.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -29,12 +29,7 @@
             inline int
             operator()(BOOST_FUSION_R_ELSE_LREF(E) e, int count)
             {
- if(f(BOOST_FUSION_FORWARD(E,e)))
- {
- return count+1;
- }
-
- return count;
+ return f(BOOST_FUSION_FORWARD(E,e)) ? ++count : count;
             }
 
             FRef f;

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/all.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/all.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/all.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -9,10 +9,6 @@
 #ifndef BOOST_FUSION_ALGORITHM_QUERY_DETAIL_ALL_HPP
 #define BOOST_FUSION_ALGORITHM_QUERY_DETAIL_ALL_HPP
 
-#include <boost/fusion/sequence/intrinsic/empty.hpp>
-#include <boost/fusion/sequence/intrinsic/size.hpp>
-#include <boost/fusion/sequence/intrinsic/begin.hpp>
-#include <boost/fusion/sequence/intrinsic/end.hpp>
 #include <boost/fusion/iterator/advance.hpp>
 #include <boost/fusion/iterator/equal_to.hpp>
 #include <boost/fusion/iterator/next.hpp>
@@ -20,117 +16,111 @@
 
 #include <boost/mpl/bool.hpp>
 
-//TODO code based on fold!!!
-
 namespace boost { namespace fusion { namespace detail
 {
- template <typename SeqRef, typename First, typename F>
- inline bool
- linear_all(First const&, BOOST_FUSION_R_ELSE_LREF(F), mpl::true_)
- {
- return true;
- }
-
- template <typename SeqRef,typename First, typename F>
- inline bool
- linear_all(First const& first, BOOST_FUSION_R_ELSE_LREF(F) f, mpl::false_)
- {
- return f(fusion::deref(first)) &&
- detail::linear_all(
- fusion::next(first)
- , BOOST_FUSION_FORWARD(F,f)
- , result_of::equal_to<
- typename result_of::next<First>::type,
- typename result_of::end<SeqRef>::type
- >::type());
- }
-
- template <typename Seq, typename F, typename Tag>
- inline bool
- all(BOOST_FUSION_R_ELSE_LREF(Seq) seq, BOOST_FUSION_R_ELSE_LREF(F) f, Tag)
- {
- return detail::linear_all<BOOST_FUSION_R_ELSE_LREF(Seq)>(
- fusion::begin(BOOST_FUSION_FORWARD(Seq,seq))
- , BOOST_FUSION_FORWARD(F,f)
- , result_of::empty<BOOST_FUSION_R_ELSE_LREF(Seq)>::type());
- }
-
     template<int N>
     struct unrolled_all
     {
- template <typename It, typename F>
- static bool call(It const& it, BOOST_FUSION_R_ELSE_LREF(F) f)
+ template <typename It0, typename F>
+ static bool
+ call(It0 const& it0, BOOST_FUSION_R_ELSE_LREF(F) f)
         {
- return
- f(fusion::deref(it)) &&
- f(fusion::deref(fusion::advance_c<1>(it)))&&
- f(fusion::deref(fusion::advance_c<2>(it))) &&
- f(fusion::deref(fusion::advance_c<3>(it))) &&
- detail::unrolled_all<N-4>::call(fusion::advance_c<4>(it), f);
+ if(!f(fusion::deref(it0)))
+ {
+ return false;
+ }
+
+ typedef typename result_of::next<It0 const&>::type It1;
+ It1 it1 = fusion::next(it0);
+ if(!f(fusion::deref(it1)))
+ {
+ return false;
+ }
+
+ typedef typename result_of::next<It1&>::type It2;
+ It2 it2 = fusion::next(it1);
+ if(!f(fusion::deref(it2)))
+ {
+ return false;
+ }
+
+ typedef typename result_of::next<It2&>::type It3;
+ It3 it3 = fusion::next(it3);
+ if(!f(fusion::deref(it3)))
+ {
+ return false;
+ }
+
+ return detail::unrolled_all<N-4>::call(
+ fusion::next(it3)
+ , BOOST_FUSION_FORWARD(F,f));
         }
     };
 
     template<>
     struct unrolled_all<3>
     {
- template <typename It, typename F>
- static bool call(It const& it, BOOST_FUSION_R_ELSE_LREF(F) f)
+ template <typename It0, typename F>
+ static bool
+ call(It0 const& it0, BOOST_FUSION_R_ELSE_LREF(F) f)
         {
- return
- f(fusion::deref(it)) &&
- f(fusion::deref(fusion::advance_c<1>(it))) &&
- f(fusion::deref(fusion::advance_c<2>(it)));
+ if(!f(fusion::deref(it0)))
+ {
+ return false;
+ }
+
+ typedef typename result_of::next<It0 const&>::type It1;
+ It1 it1 = fusion::next(it0);
+ if(!f(fusion::deref(it1)))
+ {
+ return false;
+ }
+
+ typedef typename result_of::next<It1&>::type It2;
+ It2 it2 = fusion::next(it1);
+ return f(fusion::deref(it2));
         }
     };
 
     template<>
     struct unrolled_all<2>
     {
- template <typename It, typename F>
- static bool call(It const& it, BOOST_FUSION_R_ELSE_LREF(F) f)
+ template <typename It0, typename F>
+ static bool
+ call(It0 const& it0, BOOST_FUSION_R_ELSE_LREF(F) f)
         {
- return
- f(fusion::deref(it)) &&
- f(fusion::deref(fusion::advance_c<1>(it)));
+ if(!f(fusion::deref(it0)))
+ {
+ return false;
+ }
+
+ typedef typename result_of::next<It0 const&>::type It1;
+ It1 it1 = fusion::next(it0);
+ return f(fusion::deref(it1));
         }
     };
 
     template<>
     struct unrolled_all<1>
     {
- template <typename It, typename F>
- static bool call(It const& it, BOOST_FUSION_R_ELSE_LREF(F) f)
+ template <typename It0, typename F>
+ static bool
+ call(It0 const& it0, BOOST_FUSION_R_ELSE_LREF(F) f)
         {
- return f(fusion::deref(it));
+ return f(fusion::deref(it0));
         }
     };
 
     template<>
     struct unrolled_all<0>
     {
- template <typename It, typename F>
- static bool call(It const& it, F const& f)
+ template <typename It0, typename F>
+ static bool
+ call(It0 const& it0, F const& f)
         {
             return false;
         }
     };
-
- template <typename Seq, typename F>
- inline bool
- all(BOOST_FUSION_R_ELSE_LREF(Seq) seq,
- BOOST_FUSION_R_ELSE_LREF(F) f,
- random_access_traversal_tag)
- {
- typedef
- detail::unrolled_all<
- result_of::size<BOOST_FUSION_R_ELSE_LREF(Seq)>::value
- >
- gen;
-
- return gen::call(
- fusion::begin(BOOST_FUSION_FORWARD(Seq,seq)),
- BOOST_FUSION_FORWARD(F,f));
- }
 }}}
 
 #endif

Deleted: sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/any.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/any.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
+++ (empty file)
@@ -1,136 +0,0 @@
-/*=============================================================================
- Copyright (c) 2001-2006 Joel de Guzman
- Copyright (c) 2007 Dan Marsden
-
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-==============================================================================*/
-
-#ifndef BOOST_FUSION_ALGORITHM_QUERY_DETAIL_ANY_HPP
-#define BOOST_FUSION_ALGORITHM_QUERY_DETAIL_ANY_HPP
-
-#include <boost/fusion/sequence/intrinsic/empty.hpp>
-#include <boost/fusion/sequence/intrinsic/size.hpp>
-#include <boost/fusion/sequence/intrinsic/begin.hpp>
-#include <boost/fusion/sequence/intrinsic/end.hpp>
-#include <boost/fusion/iterator/advance.hpp>
-#include <boost/fusion/iterator/equal_to.hpp>
-#include <boost/fusion/iterator/next.hpp>
-#include <boost/fusion/iterator/deref.hpp>
-
-#include <boost/mpl/bool.hpp>
-
-//TODO code based on fold!!!
-
-namespace boost { namespace fusion { namespace detail
-{
- template <typename SeqRef, typename First, typename F>
- inline bool
- linear_any(First const&, BOOST_FUSION_R_ELSE_LREF(F), mpl::true_)
- {
- return true;
- }
-
- template <typename SeqRef,typename First, typename F>
- inline bool
- linear_any(First const& first, BOOST_FUSION_R_ELSE_LREF(F) f, mpl::false_)
- {
- return f(fusion::deref(first)) ||
- detail::linear_any(
- fusion::next(first)
- , BOOST_FUSION_FORWARD(F,f)
- , result_of::equal_to<
- typename result_of::next<First>::type,
- typename result_of::end<SeqRef>::type
- >::type());
- }
-
- template <typename Seq, typename F, typename Tag>
- inline bool
- any(BOOST_FUSION_R_ELSE_LREF(Seq) seq, BOOST_FUSION_R_ELSE_LREF(F) f, Tag)
- {
- return detail::linear_any<BOOST_FUSION_R_ELSE_LREF(Seq)>(
- fusion::begin(BOOST_FUSION_FORWARD(Seq,seq))
- , BOOST_FUSION_FORWARD(F,f)
- , result_of::empty<BOOST_FUSION_R_ELSE_LREF(Seq)>::type());
- }
-
- template<int N>
- struct unrolled_any
- {
- template <typename It, typename F>
- static bool call(It const& it, BOOST_FUSION_R_ELSE_LREF(F) f)
- {
- return
- f(fusion::deref(it)) ||
- f(fusion::deref(fusion::advance_c<1>(it)))||
- f(fusion::deref(fusion::advance_c<2>(it))) ||
- f(fusion::deref(fusion::advance_c<3>(it))) ||
- detail::unrolled_any<N-4>::call(fusion::advance_c<4>(it), f);
- }
- };
-
- template<>
- struct unrolled_any<3>
- {
- template <typename It, typename F>
- static bool call(It const& it, BOOST_FUSION_R_ELSE_LREF(F) f)
- {
- return
- f(fusion::deref(it)) ||
- f(fusion::deref(fusion::advance_c<1>(it))) ||
- f(fusion::deref(fusion::advance_c<2>(it)));
- }
- };
-
- template<>
- struct unrolled_any<2>
- {
- template <typename It, typename F>
- static bool call(It const& it, BOOST_FUSION_R_ELSE_LREF(F) f)
- {
- return
- f(fusion::deref(it)) ||
- f(fusion::deref(fusion::advance_c<1>(it)));
- }
- };
-
- template<>
- struct unrolled_any<1>
- {
- template <typename It, typename F>
- static bool call(It const& it, BOOST_FUSION_R_ELSE_LREF(F) f)
- {
- return f(fusion::deref(it));
- }
- };
-
- template<>
- struct unrolled_any<0>
- {
- template <typename It, typename F>
- static bool call(It const& it, F const& f)
- {
- return false;
- }
- };
-
- template <typename Seq, typename F>
- inline bool
- any(BOOST_FUSION_R_ELSE_LREF(Seq) seq,
- BOOST_FUSION_R_ELSE_LREF(F) f,
- random_access_traversal_tag)
- {
- typedef
- detail::unrolled_any<
- result_of::size<BOOST_FUSION_R_ELSE_LREF(Seq)>::value
- >
- gen;
-
- return gen::call(
- fusion::begin(BOOST_FUSION_FORWARD(Seq,seq)),
- BOOST_FUSION_FORWARD(F,f));
- }
-}}}
-
-#endif

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/count.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/count.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/count.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -8,7 +8,6 @@
 #ifndef BOOST_FUSION_ALGORITHM_QUERY_DETAIL_COUNT_HPP
 #define BOOST_FUSION_ALGORITHM_QUERY_DETAIL_COUNT_HPP
 
-#include <boost/mpl/or.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 
 namespace boost { namespace fusion { namespace detail
@@ -41,9 +40,9 @@
     };
 
     template <typename T1Ref>
- struct count_compare
+ struct count_helper
     {
- count_compare(T1Ref x)
+ count_helper(T1Ref x)
           : x(x)
         {}
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/find_if.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/find_if.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/find_if.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -20,12 +20,14 @@
 #include <boost/mpl/identity.hpp>
 #include <boost/mpl/eval_if.hpp>
 #include <boost/mpl/or.hpp>
-#include <boost/mpl/lambda.hpp>
 #include <boost/mpl/apply.hpp>
 #include <boost/mpl/identity.hpp>
 
+//TODO cschmidt: is this really worth the effort?
+
 namespace boost { namespace fusion {
     struct random_access_traversal_tag;
+
 namespace detail
 {
     template <typename It, typename Pred>
@@ -200,7 +202,7 @@
             choose_find_if<
                 First
               , Last
- , typename mpl::lambda<Pred>::type
+ , Pred
               , is_base_of<
                     random_access_traversal_tag
                   , typename traits::category_of<First>::type

Deleted: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/replace.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/replace.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
+++ (empty file)
@@ -1,32 +0,0 @@
-/*=============================================================================
- Copyright (c) 2001-2006 Joel de Guzman
-
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-==============================================================================*/
-
-#ifndef BOOST_FUSION_ALGORITHM_TRANSFORMATION_DETAIL_REPLACE_HPP
-#define BOOST_FUSION_ALGORITHM_TRANSFORMATION_DETAIL_REPLACE_HPP
-
-namespace boost { namespace fusion { namespace detail
-{
- template <typename OldValue>
- struct replacer
- {
- template <typename OldValue_>
- replacer(BOOST_FUSION_R_ELSE_LREF(OldValue_) old_value,int)
- : old_value(old_value)
- {}
-
- template <typename U>
- bool
- operator()(BOOST_FUSION_R_ELSE_LREF(U) x) const
- {
- return x==old_value;
- }
-
- OldValue old_value;
- };
-}}}
-
-#endif

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/replace_if.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/replace_if.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/detail/replace_if.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -45,30 +45,14 @@
         }
     };
 
- //TODO !!!
     template <typename F, typename NewValue>
- struct replacer_if
+ struct replace_if_helper
     {
- replacer_if(BOOST_FUSION_R_ELSE_CLREF(replacer_if) replacer)
- : f(BOOST_FUSION_FORWARD(
- BOOST_FUSION_R_ELSE_CLREF(replacer_if),replacer).f)
- , new_value(BOOST_FUSION_FORWARD(
- BOOST_FUSION_R_ELSE_CLREF(replacer_if),replacer).new_value)
- {}
-
- template<typename OtherF, typename OtherNewValue>
- replacer_if(
- BOOST_FUSION_R_ELSE_LREF(OtherF) other_f,
- BOOST_FUSION_R_ELSE_LREF(OtherNewValue) other_new_value)
- : f(BOOST_FUSION_FORWARD(OtherF,other_f))
- , new_value(BOOST_FUSION_FORWARD(OtherNewValue,other_new_value))
- {}
-
         template<typename Params>
         struct result;
 
         template <typename U>
- struct result<replacer_if<F, NewValue>(U)>
+ struct result<replace_if_helper<F, NewValue>(U)>
         {
             typedef typename
                 mpl::if_<
@@ -82,8 +66,31 @@
             type;
         };
 
+ template<typename OtherF, typename OtherNewValue>
+ replace_if_helper(
+ BOOST_FUSION_R_ELSE_LREF(OtherF) other_f,
+ BOOST_FUSION_R_ELSE_LREF(OtherNewValue) other_new_value)
+ : f(BOOST_FUSION_FORWARD(OtherF,other_f))
+ , new_value(BOOST_FUSION_FORWARD(OtherNewValue,other_new_value))
+ {}
+
+ template<typename Replacer>
+ replace_if_helper(BOOST_FUSION_R_ELSE_LREF(Replacer) replacer)
+ : f(BOOST_FUSION_FORWARD(Replacer,replacer).f)
+ , new_value(BOOST_FUSION_FORWARD(Replacer,replacer).new_value)
+ {}
+
+ template<typename Replacer>
+ replace_if_helper&
+ operator=(BOOST_FUSION_R_ELSE_LREF(Replacer) replacer)
+ {
+ f=BOOST_FUSION_FORWARD(Replacer,replacer).f;
+ new_value=BOOST_FUSION_FORWARD(Replacer,replacer).new_value;
+ return *this;
+ }
+
         template <typename U>
- typename result<replacer_if(U)>::type
+ typename result<replace_if_helper(U)>::type
         operator()(BOOST_FUSION_R_ELSE_LREF(U) x) const
         {
             typedef

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/erase.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/erase.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/erase.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -17,7 +17,6 @@
 
 #include <boost/mpl/eval_if.hpp>
 #include <boost/mpl/identity.hpp>
-#include <boost/type_traits/add_const.hpp>
 
 namespace boost { namespace fusion
 {

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/remove.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/remove.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/remove.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -9,7 +9,9 @@
 #define BOOST_FUSION_ALGORITHM_TRANSFORMATION_REMOVE_HPP
 
 #include <boost/fusion/view/filter_view/filter_view.hpp>
+
 #include <boost/mpl/not.hpp>
+#include <boost/mpl/placeholders.hpp>
 #include <boost/type_traits/is_same.hpp>
 
 namespace boost { namespace fusion

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -8,7 +8,6 @@
 #ifndef BOOST_FUSION_ALGORITHM_TRANSFORMATION_REPLACE_HPP
 #define BOOST_FUSION_ALGORITHM_TRANSFORMATION_REPLACE_HPP
 
-#include <boost/fusion/view/transform_view/transform_view.hpp>
 #include <boost/fusion/algorithm/transformation/replace_if.hpp>
 #include <boost/fusion/support/ref.hpp>
 #include <boost/fusion/support/detail/as_fusion_element.hpp>
@@ -17,20 +16,55 @@
 
 namespace boost { namespace fusion
 {
+ namespace detail
+ {
+ template <typename OldValue>
+ struct replace_helper
+ {
+ template <typename OtherOldValue>
+ replace_helper(
+ BOOST_FUSION_R_ELSE_LREF(OtherOldValue) old_value
+ , int)
+ : old_value(BOOST_FUSION_FORWARD(OtherOldValue,old_value))
+ {}
+
+ template<typename Replacer>
+ replace_helper(BOOST_FUSION_R_ELSE_LREF(Replacer) replacer)
+ : old_value(BOOST_FUSION_FORWARD(Replacer,replacer).old_value)
+ {}
+
+ template<typename Replacer>
+ replace_helper&
+ operator=(BOOST_FUSION_R_ELSE_LREF(Replacer) replacer)
+ {
+ old_value=BOOST_FUSION_FORWARD(Replacer,replacer).old_value;
+ return *this;
+ }
+
+ template <typename U>
+ bool
+ operator()(BOOST_FUSION_R_ELSE_LREF(U) x) const
+ {
+ return x==old_value;
+ }
+
+ OldValue old_value;
+ };
+ }
+
     namespace result_of
     {
- //TODO New arg?!
+ //TODO New arg?!
         template <typename Seq, typename OldValue, typename NewValue>
         struct replace
- : replace_if<
- Seq
- , BOOST_FUSION_R_ELSE_CLREF(
- detail::replacer<
- typename detail::as_fusion_element<OldValue>::type
- >)
- , NewValue
- >
         {
+ typedef
+ detail::replace_helper<
+ typename detail::as_fusion_element<OldValue>::type
+ >
+ replacer;
+
+ typedef typename replace_if<Seq, replacer, NewValue>::type type;
         };
     }
 
@@ -51,14 +85,7 @@
                 BOOST_FUSION_R_ELSE_LREF(Seq)
               , BOOST_FUSION_R_ELSE_CLREF(OldValue)
               , BOOST_FUSION_R_ELSE_CLREF(NewValue)
- >::type
- type;
- typedef
- detail::replacer<
- typename detail::as_fusion_element<
- BOOST_FUSION_R_ELSE_CLREF(OldValue)
- >::type
- >
+ >::replacer
         replacer;
 
         return replace_if(

Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace_if.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace_if.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace_if.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -11,9 +11,6 @@
 #include <boost/fusion/view/transform_view/transform_view.hpp>
 #include <boost/fusion/support/ref.hpp>
 #include <boost/fusion/support/detail/as_fusion_element.hpp>
-
-#include <boost/type_traits/add_const.hpp>
-
 #include <boost/fusion/algorithm/transformation/detail/replace_if.hpp>
 
 namespace boost { namespace fusion
@@ -24,7 +21,7 @@
         struct replace_if
         {
             typedef
- detail::replacer_if<
+ detail::replace_if_helper<
                     typename detail::as_fusion_element<F>::type
                   , typename detail::as_fusion_element<T>::type
>
@@ -53,8 +50,9 @@
         result;
 
         return typename result::type(BOOST_FUSION_FORWARD(Seq,seq),
- typename result::replacer(BOOST_FUSION_FORWARD(F,pred),
- BOOST_FUSION_FORWARD(NewValue,new_value)));
+ typename result::replacer(
+ BOOST_FUSION_FORWARD(F,pred),
+ BOOST_FUSION_FORWARD(NewValue,new_value)));
     }
 }}
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/container/list/cons_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/container/list/cons_iterator.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/container/list/cons_iterator.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -11,7 +11,6 @@
 
 #include <boost/fusion/support/iterator_base.hpp>
 #include <boost/fusion/container/list/list_fwd.hpp>
-#include <boost/type_traits/add_const.hpp>
 
 #include <boost/fusion/container/list/detail/cons/deref_impl.hpp>
 #include <boost/fusion/container/list/detail/cons/next_impl.hpp>

Modified: sandbox/SOC/2009/fusion/boost/fusion/container/map/detail/pp/lookup_key.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/container/map/detail/pp/lookup_key.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/container/map/detail/pp/lookup_key.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -8,7 +8,6 @@
 #ifndef BOOST_FUSION_CONTAINER_MAP_DETAIL_PP_LOOKUP_KEY_HPP
 #define BOOST_FUSION_CONTAINER_MAP_DETAIL_PP_LOOKUP_KEY_HPP
 
-#include <boost/type_traits/add_const.hpp>
 #include <boost/type_traits/add_reference.hpp>
 #include <boost/fusion/support/detail/pp/unknown_key.hpp>
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/container/map/map.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/container/map/map.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/container/map/map.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -34,6 +34,7 @@
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/identity.hpp>
 #include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/add_const.hpp>
 
 namespace boost { namespace fusion
 {

Modified: sandbox/SOC/2009/fusion/boost/fusion/support/detail/pp/void.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/support/detail/pp/void.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/support/detail/pp/void.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -10,7 +10,8 @@
 
 namespace boost { namespace fusion
 {
- struct void_ {};
+ struct void_
+ {};
 }}
 
 #endif

Modified: sandbox/SOC/2009/fusion/libs/fusion/example/extension/example_struct_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/extension/example_struct_iterator.hpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/extension/example_struct_iterator.hpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -12,7 +12,6 @@
 #include <boost/fusion/support/iterator_base.hpp>
 #include <boost/fusion/support/tag_of_fwd.hpp>
 #include <boost/mpl/int.hpp>
-#include <boost/type_traits/add_const.hpp>
 #include <boost/static_assert.hpp>
 
 #include "./detail/next_impl.hpp"

Modified: sandbox/SOC/2009/fusion/libs/fusion/example/test/main.cpp
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/example/test/main.cpp (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/example/test/main.cpp 2009-07-07 17:45:47 EDT (Tue, 07 Jul 2009)
@@ -19,10 +19,17 @@
 
 struct moveable
 {
- moveable()=default;
- moveable(const moveable&)=delete;
+ moveable(int){};
     moveable(moveable&&){}
+ moveable& operator=(moveable&&){return *this;}
+ moveable()=delete;
+ moveable(moveable const&)=delete;
+ moveable& operator=(moveable const&)=delete;
 };
+bool operator==(moveable const&, moveable const&)
+{
+ return true;
+}
 
 template<class... Args>
 struct get_vec_type
@@ -120,7 +127,7 @@
     }
 
     {
- vec v;
+ vec v(0,0,0,0,0,0,0);
         vec v2=std::move(v);
         //vec v2=v;
     }
@@ -142,4 +149,10 @@
         seq_test(transform_view<vector<int>&&,identity_int>(vector<int>(),identity_int()));
         seq_test(reverse_view<vector<int>&&>(vector<int>()));
     }
+
+ {
+ using namespace fusion;
+ vector<moveable> m(0);
+ replace(m, moveable(0), moveable(0))=replace(m, moveable(0), moveable(0));
+ }
 }


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