|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54777 - in sandbox/SOC/2009/fusion/boost/fusion: algorithm/query algorithm/query/detail algorithm/transformation support support/detail/pp
From: mr.chr.schmidt_at_[hidden]
Date: 2009-07-07 14:42:41
Author: cschmidt
Date: 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
New Revision: 54777
URL: http://svn.boost.org/trac/boost/changeset/54777
Log:
cleanup
Added:
sandbox/SOC/2009/fusion/boost/fusion/support/detail/pp/void.hpp (contents, props changed)
Removed:
sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/count_if.hpp
sandbox/SOC/2009/fusion/boost/fusion/support/void.hpp
Text files modified:
sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/count_if.hpp | 38 +++++++++++++++++++++++++++++++-------
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/erase.hpp | 5 ++---
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/filter.hpp | 7 +------
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/filter_if.hpp | 7 +------
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/insert.hpp | 7 +++----
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/insert_range.hpp | 8 +++-----
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/join.hpp | 7 +------
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/push_back.hpp | 6 ++----
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/push_front.hpp | 2 +-
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/remove.hpp | 5 +----
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/remove_if.hpp | 5 +----
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/replace_if.hpp | 7 +------
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/reverse.hpp | 4 ++--
sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/transform.hpp | 8 +-------
14 files changed, 51 insertions(+), 65 deletions(-)
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 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -9,13 +9,38 @@
#ifndef BOOST_FUSION_ALGORITHM_QUERY_COUNT_IF_HPP
#define BOOST_FUSION_ALGORITHM_QUERY_COUNT_IF_HPP
+#include <boost/fusion/algorithm/iteration/fold.hpp>
#include <boost/fusion/support/ref.hpp>
-#include <boost/fusion/support/category_of.hpp>
-
-#include <boost/fusion/algorithm/query/detail/count_if.hpp>
namespace boost { namespace fusion
{
+ namespace detail
+ {
+ template<typename FRef>
+ struct count_if_helper
+ {
+ typedef int result_type;
+
+ count_if_helper(FRef f)
+ : f(f)
+ {}
+
+ template<typename E>
+ inline int
+ operator()(BOOST_FUSION_R_ELSE_LREF(E) e, int count)
+ {
+ if(f(BOOST_FUSION_FORWARD(E,e)))
+ {
+ return count+1;
+ }
+
+ return count;
+ }
+
+ FRef f;
+ };
+ }
+
namespace result_of
{
template <typename Seq, typename F>
@@ -29,11 +54,10 @@
inline int
count_if(BOOST_FUSION_R_ELSE_LREF(Seq) seq, BOOST_FUSION_R_ELSE_LREF(F) f)
{
- return detail::count_if(
+ return fold(
BOOST_FUSION_FORWARD(Seq,seq),
- BOOST_FUSION_FORWARD(F,f),
- typename traits::category_of<BOOST_FUSION_R_ELSE_LREF(Seq)>::type()
- );
+ 0,
+ detail::count_if_helper<BOOST_FUSION_R_ELSE_LREF(F)>(f));
}
}}
Deleted: sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/count_if.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/query/detail/count_if.hpp 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
+++ (empty file)
@@ -1,205 +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_COUNT_IF_HPP
-#define BOOST_FUSION_ALGORITHM_QUERY_DETAIL_COUNT_IF_HPP
-
-#include <boost/fusion/sequence/intrinsic/begin.hpp>
-#include <boost/fusion/sequence/intrinsic/end.hpp>
-#include <boost/fusion/sequence/intrinsic/empty.hpp>
-#include <boost/fusion/iterator/equal_to.hpp>
-#include <boost/fusion/iterator/next.hpp>
-#include <boost/fusion/iterator/deref.hpp>
-#include <boost/fusion/iterator/equal_to.hpp>
-#include <boost/fusion/iterator/advance.hpp>
-
-#include <boost/mpl/bool.hpp>
-
-namespace boost { namespace fusion {
- struct random_access_traversal_tag;
-
- //code based on fold!!!
-
- namespace detail
- {
- template <typename SeqRef, typename First, typename F>
- inline int
- linear_count_if(First const&, BOOST_FUSION_R_ELSE_LREF(F), mpl::true_)
- {
- return 0;
- }
-
- template <typename SeqRef, typename First, typename F>
- inline int
- linear_count_if(
- First const& first,
- BOOST_FUSION_R_ELSE_LREF(F) f,
- mpl::false_)
- {
- int n = detail::linear_count_if(
- fusion::next(first)
- , f
- , result_of::equal_to<
- typename result_of::next<First>::type,
- typename result_of::end<SeqRef>::type
- >::value);
- if(f(*first))
- {
- ++n;
- }
-
- return n;
- }
-
- template <typename Seq, typename F, typename Tag>
- inline int
- count_if(BOOST_FUSION_R_ELSE_LREF(Seq) seq,
- BOOST_FUSION_R_ELSE_LREF(F) f,
- Tag)
- {
- return detail::linear_count_if<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_count_if
- {
- template<typename It0, typename F>
- static int call(It0 const& it0, BOOST_FUSION_R_ELSE_LREF(F) f)
- {
- int ct = unrolled_count_if<n-4>::
- call(fusion::advance_c<4>(it0), BOOST_FUSION_FORWARD(F,f));
- if(f(fusion::deref(it0)))
- {
- ++ct;
- }
-
- typedef typename result_of::next<It0>::type It1;
- It1 it1(fusion::next(it0));
- if(f(fusion::deref(it1)))
- {
- ++ct;
- }
-
- typedef typename result_of::next<It1>::type It2;
- It2 it2(fusion::next(it1));
- if(f(fusion::deref(it2)))
- {
- ++ct;
- }
-
- typedef typename result_of::next<It2>::type It3;
- It3 it3(fusion::next(it2));
- if(f(fusion::deref(it3)))
- {
- ++ct;
- }
-
- return ct;
- }
- };
-
- template<>
- struct unrolled_count_if<3>
- {
- template<typename It0, typename F>
- static int call(It0 const& it0, BOOST_FUSION_R_ELSE_LREF(F) f)
- {
- int ct = 0;
- if(f(fusion::deref(it0)))
- {
- ++ct;
- }
-
- typedef typename result_of::next<It0>::type It1;
- It1 it1(fusion::next(it0));
- if(f(fusion::deref(it1)))
- {
- ++ct;
- }
-
- typedef typename result_of::next<It1>::type It2;
- It2 it2(fusion::next(it1));
- if(f(fusion::deref(it2)))
- {
- ++ct;
- }
-
- return ct;
- }
- };
-
- template<>
- struct unrolled_count_if<2>
- {
- template<typename It0, typename F>
- static int call(It0 const& it0, BOOST_FUSION_R_ELSE_LREF(F) f)
- {
- int ct = 0;
- if(f(fusion::deref(it0)))
- {
- ++ct;
- }
-
- typedef typename result_of::next<It0>::type It1;
- It1 it1(fusion::next(it0));
- if(f(fusion::deref(it1)))
- {
- ++ct;
- }
-
- return ct;
- }
- };
-
- template<>
- struct unrolled_count_if<1>
- {
- template<typename It0, typename F>
- static int call(It0 const& it0, BOOST_FUSION_R_ELSE_LREF(F) f)
- {
- int ct = 0;
- if(f(fusion::deref(it0)))
- {
- ++ct;
- }
-
- return ct;
- }
- };
-
- template<>
- struct unrolled_count_if<0>
- {
- template<typename It0, typename F>
- static int call(It0 const&, BOOST_FUSION_R_ELSE_LREF(F))
- {
- return 0;
- }
- };
-
- template <typename Seq, typename F>
- inline int
- count_if(BOOST_FUSION_R_ELSE_LREF(Seq) seq,
- BOOST_FUSION_R_ELSE_LREF(F) f,
- random_access_traversal_tag)
- {
- typedef
- unrolled_count_if<
- result_of::size<BOOST_FUSION_R_ELSE_LREF(Seq)>::value
- >
- gen;
-
- return gen::call(fusion::begin(seq),BOOST_FUSION_FORWARD(F,f));
- }
- }
-}}
-
-#endif
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 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -81,17 +81,16 @@
typedef
iterator_range<
seq_first_type
- , typename detail::identity<First>::type
+ , First
>
left_type;
typedef
iterator_range<
- typename detail::identity<Last>::type
+ Last
, seq_last_type
>
right_type;
- //TODO !!!
typedef
joint_view<left_type, right_type>
type;
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/filter.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/filter.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/filter.hpp 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -22,12 +22,7 @@
template <typename Seq, typename T>
struct filter
{
- typedef
- filter_view<
- typename detail::add_lref<Seq>::type
- , is_same<mpl::_, T>
- >
- type;
+ typedef filter_view<Seq, is_same<mpl::_, T> > type;
};
}
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/filter_if.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/filter_if.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/filter_if.hpp 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -17,12 +17,7 @@
template <typename Seq, typename Pred>
struct filter_if
{
- typedef
- filter_view<
- typename detail::add_lref<Seq>::type
- , Pred
- >
- type;
+ typedef filter_view<Seq, Pred> type;
};
}
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/insert.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/insert.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/insert.hpp 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -19,10 +19,9 @@
template <typename Seq, typename Pos, typename T>
struct insert
: insert_range<
- typename detail::add_lref<Seq>::type
- , typename detail::add_lref<Pos>::type
- , BOOST_FUSION_R_ELSE_CLREF(
- single_view<typename detail::as_fusion_element<T>::type>)
+ Seq
+ , Pos
+ , single_view<typename detail::as_fusion_element<T>::type>
>
{
};
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/insert_range.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/insert_range.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/insert_range.hpp 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -22,19 +22,16 @@
template <typename Seq, typename Pos, typename Range>
struct insert_range
{
- typedef typename result_of::begin<Seq>::type first_type;
- typedef typename result_of::end<Seq>::type last_type;
-
typedef
iterator_range<
- first_type
+ typename result_of::begin<Seq>::type
, typename detail::add_lref<Pos>::type
>
left_type;
typedef
iterator_range<
typename detail::add_lref<Pos>::type
- , last_type
+ , typename result_of::end<Seq>::type
>
right_type;
typedef
@@ -43,6 +40,7 @@
, typename detail::add_lref<Range>::type
>
left_insert_type;
+
typedef joint_view<left_insert_type, right_type> type;
};
}
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/join.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/join.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/join.hpp 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -18,12 +18,7 @@
template<typename Lhs, typename Rhs>
struct join
{
- typedef
- joint_view<
- typename detail::add_lref<Lhs>::type
- , typename detail::add_lref<Rhs>::type
- >
- type;
+ typedef joint_view<Lhs,Rhs> type;
};
}
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/push_back.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/push_back.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/push_back.hpp 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -21,10 +21,8 @@
{
typedef
joint_view<
- typename detail::add_lref<Seq>::type
- , fusion::single_view<
- typename detail::as_fusion_element<T>::type
- >
+ Seq
+ , single_view<typename detail::as_fusion_element<T>::type>
>
type;
};
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/push_front.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/push_front.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/push_front.hpp 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -25,7 +25,7 @@
fusion::single_view<
typename detail::as_fusion_element<T>::type
>
- , typename detail::add_lref<Seq>::type
+ , Seq
>
type;
};
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 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -20,10 +20,7 @@
struct remove
{
typedef
- filter_view<
- typename detail::add_lref<Seq>::type
- , mpl::not_<is_same<mpl::_, T> >
- >
+ filter_view<Seq, mpl::not_<is_same<mpl::_, T> > >
type;
};
}
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/remove_if.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/remove_if.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/remove_if.hpp 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -19,10 +19,7 @@
struct remove_if
{
typedef
- filter_view<
- typename detail::add_lref<Seq>::type
- , mpl::not_<Pred>
- >
+ filter_view<Seq, mpl::not_<Pred> >
type;
};
}
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 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -30,12 +30,7 @@
>
replacer;
- typedef
- transform_view<
- typename detail::add_lref<Seq>::type
- , replacer
- >
- type;
+ typedef transform_view<Seq, replacer> type;
};
}
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/reverse.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/reverse.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/reverse.hpp 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -22,10 +22,10 @@
}
template <typename Seq>
- inline reverse_view<BOOST_FUSION_R_ELSE_LREF(Seq)>
+ inline typename result_of::reverse<BOOST_FUSION_R_ELSE_LREF(Seq)>::type
reverse(BOOST_FUSION_R_ELSE_LREF(Seq) seq)
{
- return reverse_view<BOOST_FUSION_R_ELSE_LREF(Seq)>(
+ return typename result_of::reverse<BOOST_FUSION_R_ELSE_LREF(Seq)>::type(
BOOST_FUSION_FORWARD(Seq,seq));
}
}}
Modified: sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/transform.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/transform.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/algorithm/transformation/transform.hpp 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -19,13 +19,7 @@
template <typename Seq1, typename Seq2, typename F = void_>
struct transform
{
- typedef
- transform_view<
- typename detail::add_lref<Seq1>::type
- , typename detail::add_lref<Seq2>::type
- , typename detail::add_lref<F>::type
- >
- type;
+ typedef transform_view<Seq1,Seq2,F> type;
};
template <typename Seq, typename F>
Added: sandbox/SOC/2009/fusion/boost/fusion/support/detail/pp/void.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/support/detail/pp/void.hpp 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
@@ -0,0 +1,16 @@
+/*=============================================================================
+ 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_SUPPORT_VOID_HPP
+#define BOOST_FUSION_SUPPORT_VOID_HPP
+
+namespace boost { namespace fusion
+{
+ struct void_ {};
+}}
+
+#endif
Deleted: sandbox/SOC/2009/fusion/boost/fusion/support/void.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/support/void.hpp 2009-07-07 14:42:39 EDT (Tue, 07 Jul 2009)
+++ (empty file)
@@ -1,16 +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_SUPPORT_VOID_HPP
-#define BOOST_FUSION_SUPPORT_VOID_HPP
-
-namespace boost { namespace fusion
-{
- struct void_ {};
-}}
-
-#endif
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