|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73892 - in trunk: boost/fusion/algorithm/iteration/ext_ boost/fusion/algorithm/query boost/fusion/algorithm/query/detail boost/fusion/algorithm/query/ext_ boost/fusion/iterator/detail boost/fusion/sequence/intrinsic/detail boost/fusion/support boost/fusion/support/detail boost/fusion/view/filter_view boost/fusion/view/filter_view/detail boost/fusion/view/iterator_range/detail libs/fusion/test/algorithm libs/fusion/test/sequence
From: eric_at_[hidden]
Date: 2011-08-18 13:12:08
Author: eric_niebler
Date: 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
New Revision: 73892
URL: http://svn.boost.org/trac/boost/changeset/73892
Log:
make find and find_if algorithms segment-aware, stylistic consistency tweaks
Added:
trunk/boost/fusion/algorithm/query/detail/segmented_find.hpp
- copied, changed from r73833, /trunk/boost/fusion/algorithm/query/ext_/find_s.hpp
trunk/boost/fusion/algorithm/query/detail/segmented_find_if.hpp
- copied, changed from r73833, /trunk/boost/fusion/algorithm/query/ext_/find_if_s.hpp
trunk/boost/fusion/algorithm/query/find_fwd.hpp (contents, props changed)
trunk/boost/fusion/algorithm/query/find_if_fwd.hpp (contents, props changed)
Removed:
trunk/boost/fusion/algorithm/query/ext_/
Text files modified:
trunk/boost/fusion/algorithm/iteration/ext_/fold_s.hpp | 18 +-
trunk/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp | 8
trunk/boost/fusion/algorithm/query/detail/find_if.hpp | 36 +++++-
trunk/boost/fusion/algorithm/query/detail/segmented_find.hpp | 115 +++++++++++-------------
trunk/boost/fusion/algorithm/query/detail/segmented_find_if.hpp | 116 +++++++++++------------
trunk/boost/fusion/algorithm/query/find.hpp | 35 +++----
trunk/boost/fusion/algorithm/query/find_if.hpp | 36 +++---
trunk/boost/fusion/iterator/detail/segmented_next_impl.hpp | 16 +-
trunk/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp | 12 +-
trunk/boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp | 56 +++++-----
trunk/boost/fusion/sequence/intrinsic/detail/segmented_end.hpp | 12 +-
trunk/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp | 16 +-
trunk/boost/fusion/sequence/intrinsic/detail/segmented_size.hpp | 8
trunk/boost/fusion/support/detail/segmented_fold_until_impl.hpp | 188 ++++++++++++++++++++--------------------
trunk/boost/fusion/support/segmented_fold_until.hpp | 51 ++++++----
trunk/boost/fusion/view/filter_view/detail/next_impl.hpp | 2
trunk/boost/fusion/view/filter_view/filter_view_iterator.hpp | 2
trunk/boost/fusion/view/iterator_range/detail/is_segmented_impl.hpp | 6
trunk/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp | 100 ++++++++++----------
trunk/boost/fusion/view/iterator_range/detail/segments_impl.hpp | 4
trunk/libs/fusion/test/algorithm/segmented_find.cpp | 14 +-
trunk/libs/fusion/test/algorithm/segmented_find_if.cpp | 16 +-
trunk/libs/fusion/test/sequence/segmented_iterator_range.cpp | 12 +-
23 files changed, 447 insertions(+), 432 deletions(-)
Modified: trunk/boost/fusion/algorithm/iteration/ext_/fold_s.hpp
==============================================================================
--- trunk/boost/fusion/algorithm/iteration/ext_/fold_s.hpp (original)
+++ trunk/boost/fusion/algorithm/iteration/ext_/fold_s.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -12,18 +12,18 @@
namespace boost { namespace fusion { namespace detail
{
- template<typename Fun>
+ template <typename Fun>
struct segmented_fold_fun
{
- template<typename Sig>
+ template <typename Sig>
struct result;
- template<typename This, typename Range, typename State, typename Context>
- struct result<This(Range&, State&, Context&)>
+ template <typename This, typename Sequence, typename State, typename Context>
+ struct result<This(Sequence&, State&, Context&)>
{
typedef
fusion::result<
- typename result_of::fold<Range, State, Fun>::type,
+ typename result_of::fold<Sequence, State, Fun>::type,
continue_
>
type;
@@ -33,11 +33,11 @@
: fun(f)
{}
- template<typename Range, typename State, typename Context>
- typename result<segmented_fold_fun(Range&, State const&, Context const&)>::type
- operator()(Range& rng, State const& state, Context const&) const
+ template <typename Sequence, typename State, typename Context>
+ typename result<segmented_fold_fun(Sequence&, State const&, Context const&)>::type
+ operator()(Sequence& seq, State const& state, Context const&) const
{
- return fusion::fold(rng, state, fun);
+ return fusion::fold(seq, state, fun);
}
Fun const& fun;
Modified: trunk/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp
==============================================================================
--- trunk/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp (original)
+++ trunk/boost/fusion/algorithm/iteration/ext_/for_each_s.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -13,7 +13,7 @@
namespace boost { namespace fusion { namespace detail
{
- template<typename Fun>
+ template <typename Fun>
struct segmented_for_each_fun
{
typedef result<void, continue_> result_type;
@@ -22,10 +22,10 @@
: fun(f)
{}
- template<typename Range, typename State, typename Context>
- result_type operator()(Range& rng, State const&, Context const&) const
+ template <typename Sequence, typename State, typename Context>
+ result_type operator()(Sequence& seq, State const&, Context const&) const
{
- fusion::for_each(rng, fun);
+ fusion::for_each(seq, fun);
return void_();
}
Modified: trunk/boost/fusion/algorithm/query/detail/find_if.hpp
==============================================================================
--- trunk/boost/fusion/algorithm/query/detail/find_if.hpp (original)
+++ trunk/boost/fusion/algorithm/query/detail/find_if.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -9,19 +9,18 @@
#if !defined(FUSION_FIND_IF_05052005_1107)
#define FUSION_FIND_IF_05052005_1107
-#include <boost/mpl/eval_if.hpp>
-#include <boost/mpl/or.hpp>
-#include <boost/mpl/lambda.hpp>
#include <boost/mpl/apply.hpp>
+#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
+#include <boost/mpl/lambda.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/fusion/iterator/advance.hpp>
+#include <boost/fusion/iterator/distance.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
-#include <boost/fusion/iterator/advance.hpp>
-#include <boost/fusion/iterator/distance.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/support/category_of.hpp>
-#include <boost/mpl/eval_if.hpp>
-#include <boost/mpl/identity.hpp>
namespace boost { namespace fusion {
struct random_access_traversal_tag;
@@ -222,10 +221,31 @@
template <typename Iterator>
static type
- call(Iterator const& iter)
+ iter_call(Iterator const& iter)
{
return choose_call(iter, typename traits::category_of<Iterator>::type());
}
+
+ template <typename Sequence>
+ static type
+ call(Sequence& seq)
+ {
+ return iter_call(fusion::begin(seq));
+ }
+ };
+
+ template <typename Sequence, typename Pred>
+ struct result_of_find_if
+ {
+ typedef
+ static_find_if<
+ typename result_of::begin<Sequence>::type
+ , typename result_of::end<Sequence>::type
+ , Pred
+ >
+ filter;
+
+ typedef typename filter::type type;
};
}}}
Copied: trunk/boost/fusion/algorithm/query/detail/segmented_find.hpp (from r73833, /trunk/boost/fusion/algorithm/query/ext_/find_s.hpp)
==============================================================================
--- /trunk/boost/fusion/algorithm/query/ext_/find_s.hpp (original)
+++ trunk/boost/fusion/algorithm/query/detail/segmented_find.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -4,112 +4,103 @@
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)
==============================================================================*/
-#if !defined(BOOST_FUSION_FIND_S_HPP_INCLUDED)
-#define BOOST_FUSION_FIND_S_HPP_INCLUDED
+#if !defined(BOOST_FUSION_SEGMENTED_FIND_HPP_INCLUDED)
+#define BOOST_FUSION_SEGMENTED_FIND_HPP_INCLUDED
#include <boost/type_traits/remove_const.hpp>
-#include <boost/fusion/algorithm/query/find.hpp>
+#include <boost/fusion/algorithm/query/find_fwd.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/support/segmented_fold_until.hpp>
namespace boost { namespace fusion { namespace detail
{
- template<typename T>
+ template <typename T>
struct segmented_find_fun
{
- template<typename Sig>
+ template <typename Sig>
struct result;
- template<typename This, typename Range, typename State, typename Context>
- struct result<This(Range&, State&, Context&)>
+ template <typename This, typename Sequence, typename State, typename Context>
+ struct result<This(Sequence&, State&, Context&)>
{
typedef
- typename result_of::find<Range, T>::type
+ typename result_of::find<Sequence, T>::type
iterator_type;
typedef
typename result_of::make_segmented_iterator<
- iterator_type,
- typename remove_const<Context>::type
+ iterator_type
+ , typename remove_const<Context>::type
>::type
segmented_iterator_type;
typedef
typename mpl::if_<
result_of::equal_to<
- iterator_type,
- typename result_of::end<Range>::type
- >,
- fusion::result<typename remove_const<State>::type, continue_>, // NOT FOUND
- fusion::result<segmented_iterator_type, break_> // FOUND
+ iterator_type
+ , typename result_of::end<Sequence>::type
+ >
+ , fusion::result<typename remove_const<State>::type, continue_>, // NOT FOUND
+ fusion::result<segmented_iterator_type, break_> // FOUND
>::type
type;
};
- template<typename Range, typename State, typename Context>
- typename result<segmented_find_fun(Range&, State const&, Context const&)>::type
- operator()(Range& rng, State const&state, Context const& context) const
+ template <typename Sequence, typename State, typename Context>
+ typename result<segmented_find_fun(Sequence&, State const&, Context const&)>::type
+ operator()(Sequence& seq, State const&state, Context const& context) const
{
typedef
typename result_of::equal_to<
- typename result_of::find<Range, T>::type,
- typename result_of::end<Range>::type
+ typename result_of::find<Sequence, T>::type
+ , typename result_of::end<Sequence>::type
>::type
not_found;
- return call(rng, state, context, not_found());
+ return call(seq, state, context, not_found());
}
private:
- template<typename Range, typename State, typename Context>
- typename result<segmented_find_fun(Range&, State const&, Context const&)>::type
- call(Range&, State const&state, Context const&, mpl::true_) const
+ template <typename Sequence, typename State, typename Context>
+ typename result<segmented_find_fun(Sequence&, State const&, Context const&)>::type
+ call(Sequence&, State const&state, Context const&, mpl::true_) const
{
return state;
}
- template<typename Range, typename State, typename Context>
- typename result<segmented_find_fun(Range&, State const&, Context const&)>::type
- call(Range& rng, State const&, Context const& context, mpl::false_) const
+ template <typename Sequence, typename State, typename Context>
+ typename result<segmented_find_fun(Sequence&, State const&, Context const&)>::type
+ call(Sequence& seq, State const&, Context const& context, mpl::false_) const
{
- return fusion::make_segmented_iterator(fusion::find<T>(rng), context);
+ return fusion::make_segmented_iterator(fusion::find<T>(seq), context);
}
};
-}}}
-
-namespace boost { namespace fusion
-{
- namespace result_of
- {
- template <typename Sequence, typename T>
- struct find_s
- : result_of::segmented_fold_until<
- Sequence,
- typename result_of::end<Sequence>::type,
- detail::segmented_find_fun<T> >
- {};
- }
-
- template <typename T, typename Sequence>
- typename result_of::find_s<Sequence, T>::type
- find_s(Sequence& seq)
+ template <typename Sequence, typename T>
+ struct result_of_segmented_find
{
- return fusion::segmented_fold_until(
- seq,
- fusion::end(seq),
- detail::segmented_find_fun<T>());
- }
-
- template <typename T, typename Sequence>
- typename result_of::find_s<Sequence const, T>::type
- find_s(Sequence const& seq)
- {
- return fusion::segmented_fold_until(
- seq,
- fusion::end(seq),
- detail::segmented_find_fun<T>());
- }
-}}
+ struct filter
+ {
+ typedef
+ typename result_of::segmented_fold_until<
+ Sequence
+ , typename result_of::end<Sequence>::type
+ , segmented_find_fun<T>
+ >::type
+ type;
+
+ static type call(Sequence& seq)
+ {
+ return fusion::segmented_fold_until(
+ seq
+ , fusion::end(seq)
+ , detail::segmented_find_fun<T>());
+ }
+ };
+
+ typedef typename filter::type type;
+ };
+}}}
#endif
Copied: trunk/boost/fusion/algorithm/query/detail/segmented_find_if.hpp (from r73833, /trunk/boost/fusion/algorithm/query/ext_/find_if_s.hpp)
==============================================================================
--- /trunk/boost/fusion/algorithm/query/ext_/find_if_s.hpp (original)
+++ trunk/boost/fusion/algorithm/query/detail/segmented_find_if.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -4,111 +4,105 @@
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)
==============================================================================*/
-#if !defined(BOOST_FUSION_FIND_IF_S_HPP_INCLUDED)
-#define BOOST_FUSION_FIND_IF_S_HPP_INCLUDED
+#if !defined(BOOST_FUSION_SEGMENTED_FIND_IF_HPP_INCLUDED)
+#define BOOST_FUSION_SEGMENTED_FIND_IF_HPP_INCLUDED
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_const.hpp>
-#include <boost/fusion/algorithm/query/find_if.hpp>
+#include <boost/fusion/algorithm/query/find_if_fwd.hpp>
+#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/support/segmented_fold_until.hpp>
namespace boost { namespace fusion { namespace detail
{
- template<typename Pred>
+ template <typename Pred>
struct segmented_find_if_fun
{
- template<typename Sig>
+ template <typename Sig>
struct result;
- template<typename This, typename Range, typename State, typename Context>
- struct result<This(Range&, State&, Context&)>
+ template <typename This, typename Sequence, typename State, typename Context>
+ struct result<This(Sequence&, State&, Context&)>
{
typedef
- typename result_of::find_if<Range, Pred>::type
+ typename result_of::find_if<Sequence, Pred>::type
iterator_type;
typedef
typename result_of::make_segmented_iterator<
- iterator_type,
- typename remove_const<Context>::type
+ iterator_type
+ , typename remove_const<Context>::type
>::type
segmented_iterator_type;
typedef
typename mpl::if_<
result_of::equal_to<
- iterator_type,
- typename result_of::end<Range>::type
- >,
- fusion::result<typename remove_const<State>::type, continue_>, // NOT FOUND
- fusion::result<segmented_iterator_type, break_> // FOUND
+ iterator_type
+ , typename result_of::end<Sequence>::type
+ >
+ , fusion::result<typename remove_const<State>::type, continue_>, // NOT FOUND
+ fusion::result<segmented_iterator_type, break_> // FOUND
>::type
type;
};
- template<typename Range, typename State, typename Context>
- typename result<segmented_find_if_fun(Range&, State const&, Context const&)>::type
- operator()(Range& rng, State const& state, Context const& context) const
+ template <typename Sequence, typename State, typename Context>
+ typename result<segmented_find_if_fun(Sequence&, State const&, Context const&)>::type
+ operator()(Sequence& seq, State const& state, Context const& context) const
{
typedef
typename result_of::equal_to<
- typename result_of::find_if<Range, Pred>::type,
- typename result_of::end<Range>::type
+ typename result_of::find_if<Sequence, Pred>::type
+ , typename result_of::end<Sequence>::type
>::type
not_found;
- return call(rng, state, context, not_found());
+ return call(seq, state, context, not_found());
}
private:
- template<typename Range, typename State, typename Context>
- typename result<segmented_find_if_fun(Range&, State const&, Context const&)>::type
- call(Range&, State const& state, Context const&, mpl::true_) const
+ template <typename Sequence, typename State, typename Context>
+ typename result<segmented_find_if_fun(Sequence&, State const&, Context const&)>::type
+ call(Sequence&, State const& state, Context const&, mpl::true_) const
{
return state;
}
- template<typename Range, typename State, typename Context>
- typename result<segmented_find_if_fun(Range&, State const&, Context const&)>::type
- call(Range& rng, State const&, Context const& context, mpl::false_) const
+ template <typename Sequence, typename State, typename Context>
+ typename result<segmented_find_if_fun(Sequence&, State const&, Context const&)>::type
+ call(Sequence& seq, State const&, Context const& context, mpl::false_) const
{
- return fusion::make_segmented_iterator(fusion::find_if<Pred>(rng), context);
+ return fusion::make_segmented_iterator(fusion::find_if<Pred>(seq), context);
}
};
-}}}
-
-namespace boost { namespace fusion
-{
- namespace result_of
- {
- template <typename Sequence, typename Pred>
- struct find_if_s
- : result_of::segmented_fold_until<
- Sequence,
- typename result_of::end<Sequence>::type,
- detail::segmented_find_if_fun<Pred> >
- {};
- }
-
- template <typename Pred, typename Sequence>
- typename result_of::find_if_s<Sequence, Pred>::type
- find_if_s(Sequence& seq)
+ template <typename Sequence, typename Pred>
+ struct result_of_segmented_find_if
{
- return fusion::segmented_fold_until(
- seq,
- fusion::end(seq),
- detail::segmented_find_if_fun<Pred>());
- }
-
- template <typename Pred, typename Sequence>
- typename result_of::find_if_s<Sequence const, Pred>::type
- find_if_s(Sequence const& seq)
- {
- return fusion::segmented_fold_until(
- seq, fusion::end(seq),
- detail::segmented_find_if_fun<Pred>());
- }
-}}
+ struct filter
+ {
+ typedef
+ typename result_of::segmented_fold_until<
+ Sequence
+ , typename result_of::end<Sequence>::type
+ , segmented_find_if_fun<Pred>
+ >::type
+ type;
+
+ static type call(Sequence& seq)
+ {
+ return fusion::segmented_fold_until(
+ seq
+ , fusion::end(seq)
+ , segmented_find_if_fun<Pred>());
+ }
+ };
+
+ typedef typename filter::type type;
+ };
+}}}
#endif
Modified: trunk/boost/fusion/algorithm/query/find.hpp
==============================================================================
--- trunk/boost/fusion/algorithm/query/find.hpp (original)
+++ trunk/boost/fusion/algorithm/query/find.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -1,5 +1,6 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
+ Copyright (c) 2011 Eric Niebler
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)
@@ -7,13 +8,15 @@
#if !defined(FUSION_FIND_05052005_1107)
#define FUSION_FIND_05052005_1107
+#include <boost/fusion/algorithm/query/find_if_fwd.hpp>
#include <boost/fusion/algorithm/query/detail/find_if.hpp>
-#include <boost/fusion/sequence/intrinsic/begin.hpp>
-#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/algorithm/query/detail/segmented_find.hpp>
#include <boost/fusion/iterator/key_of.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/support/category_of.hpp>
+#include <boost/fusion/support/is_segmented.hpp>
#include <boost/mpl/if.hpp>
+#include <boost/mpl/placeholders.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/utility/enable_if.hpp>
@@ -22,17 +25,14 @@
{
namespace result_of
{
- template <
- typename Sequence
- , typename T
- >
+ template <typename Sequence, typename T>
struct find
- {
- typedef
- detail::static_find_if<
- typename result_of::begin<Sequence>::type
- , typename result_of::end<Sequence>::type
- , is_same<
+ : mpl::if_<
+ traits::is_segmented<Sequence>
+ , detail::result_of_segmented_find<Sequence, T>
+ , detail::result_of_find_if<
+ Sequence,
+ is_same<
typename mpl::if_<
traits::is_associative<Sequence>
, key_of<mpl::_1>
@@ -41,10 +41,8 @@
, T
>
>
- filter;
-
- typedef typename filter::type type;
- };
+ >::type
+ {};
}
template <typename T, typename Sequence>
@@ -56,7 +54,7 @@
find(Sequence& seq)
{
typedef typename result_of::find<Sequence, T>::filter filter;
- return filter::call(fusion::begin(seq));
+ return filter::call(seq);
}
template <typename T, typename Sequence>
@@ -64,9 +62,8 @@
find(Sequence const& seq)
{
typedef typename result_of::find<Sequence const, T>::filter filter;
- return filter::call(fusion::begin(seq));
+ return filter::call(seq);
}
}}
#endif
-
Added: trunk/boost/fusion/algorithm/query/find_fwd.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/algorithm/query/find_fwd.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -0,0 +1,34 @@
+/*=============================================================================
+ Copyright (c) 2011 Eric Niebler
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_FIND_FWD_HPP_INCLUDED)
+#define BOOST_FUSION_FIND_FWD_HPP_INCLUDED
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_const.hpp>
+
+namespace boost { namespace fusion
+{
+ namespace result_of
+ {
+ template <typename Sequence, typename T>
+ struct find;
+ }
+
+ template <typename T, typename Sequence>
+ inline typename
+ lazy_disable_if<
+ is_const<Sequence>
+ , result_of::find<Sequence, T>
+ >::type const
+ find(Sequence& seq);
+
+ template <typename T, typename Sequence>
+ inline typename result_of::find<Sequence const, T>::type const
+ find(Sequence const& seq);
+}}
+
+#endif
Modified: trunk/boost/fusion/algorithm/query/find_if.hpp
==============================================================================
--- trunk/boost/fusion/algorithm/query/find_if.hpp (original)
+++ trunk/boost/fusion/algorithm/query/find_if.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -1,5 +1,6 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
+ Copyright (c) 2011 Eric Niebler
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)
@@ -7,15 +8,17 @@
#if !defined(FUSION_FIND_IF_05052005_1108)
#define FUSION_FIND_IF_05052005_1108
+#include <boost/fusion/algorithm/query/find_if_fwd.hpp>
#include <boost/fusion/algorithm/query/detail/find_if.hpp>
-#include <boost/fusion/sequence/intrinsic/begin.hpp>
-#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/algorithm/query/detail/segmented_find_if.hpp>
#include <boost/fusion/iterator/value_of.hpp>
+#include <boost/fusion/support/is_segmented.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/bind.hpp>
#include <boost/mpl/lambda.hpp>
+#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/quote.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/is_const.hpp>
namespace boost { namespace fusion
{
@@ -23,20 +26,18 @@
{
template <typename Sequence, typename Pred>
struct find_if
- {
- typedef
- detail::static_find_if<
- typename result_of::begin<Sequence>::type
- , typename result_of::end<Sequence>::type
- , mpl::bind1<
+ : mpl::if_<
+ traits::is_segmented<Sequence>
+ , detail::result_of_segmented_find_if<Sequence, Pred>
+ , detail::result_of_find_if<
+ Sequence,
+ mpl::bind1<
typename mpl::lambda<Pred>::type
- , mpl::bind1<mpl::quote1<value_of>,mpl::_1>
+ , mpl::bind1<mpl::quote1<value_of>, mpl::_1>
>
>
- filter;
-
- typedef typename filter::type type;
- };
+ >::type
+ {};
}
template <typename Pred, typename Sequence>
@@ -48,7 +49,7 @@
find_if(Sequence& seq)
{
typedef typename result_of::find_if<Sequence, Pred>::filter filter;
- return filter::call(fusion::begin(seq));
+ return filter::call(seq);
}
template <typename Pred, typename Sequence>
@@ -56,9 +57,8 @@
find_if(Sequence const& seq)
{
typedef typename result_of::find_if<Sequence const, Pred>::filter filter;
- return filter::call(fusion::begin(seq));
+ return filter::call(seq);
}
}}
#endif
-
Added: trunk/boost/fusion/algorithm/query/find_if_fwd.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/algorithm/query/find_if_fwd.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -0,0 +1,35 @@
+/*=============================================================================
+ Copyright (c) 2011 Eric Niebler
+
+ 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)
+==============================================================================*/
+#if !defined(BOOST_FUSION_FIND_IF_FWD_HPP_INCLUDED)
+#define BOOST_FUSION_FIND_IF_FWD_HPP_INCLUDED
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_const.hpp>
+
+// Forward declaration of find_if algorithm
+namespace boost { namespace fusion
+{
+ namespace result_of
+ {
+ template <typename Sequence, typename Pred>
+ struct find_if;
+ }
+
+ template <typename Pred, typename Sequence>
+ typename
+ lazy_disable_if<
+ is_const<Sequence>
+ , result_of::find_if<Sequence, Pred>
+ >::type
+ find_if(Sequence& seq);
+
+ template <typename Pred, typename Sequence>
+ typename result_of::find_if<Sequence const, Pred>::type const
+ find_if(Sequence const& seq);
+}}
+
+#endif
Modified: trunk/boost/fusion/iterator/detail/segmented_next_impl.hpp
==============================================================================
--- trunk/boost/fusion/iterator/detail/segmented_next_impl.hpp (original)
+++ trunk/boost/fusion/iterator/detail/segmented_next_impl.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -24,7 +24,7 @@
namespace detail
{
- template <typename Range, typename Stack>
+ template <typename Sequence, typename Stack>
struct segmented_begin_impl;
//bool is_invalid(stack)
@@ -40,7 +40,7 @@
>
{};
- ////Advance the first iterator in the range at the
+ ////Advance the first iterator in the seq at the
////top of a stack of iterator ranges. Return the
////new stack.
//auto pop_front_car(stack)
@@ -126,7 +126,7 @@
template <
typename Stack,
- typename Range =
+ typename Sequence =
typename remove_reference<
typename add_const<
typename result_of::deref<
@@ -135,7 +135,7 @@
>::type
>::type,
typename Result =
- typename segmented_begin_impl<Range, Stack>::type,
+ typename segmented_begin_impl<Sequence, Stack>::type,
bool IsInvalid =
is_invalid<Result>::value>
struct segmented_next_impl_recurse2
@@ -149,14 +149,14 @@
}
};
- template <typename Stack, typename Range, typename Result>
- struct segmented_next_impl_recurse2<Stack, Range, Result, false>
+ template <typename Stack, typename Sequence, typename Result>
+ struct segmented_next_impl_recurse2<Stack, Sequence, Result, false>
{
typedef Result type;
static type call(Stack const & stack)
{
- return segmented_begin_impl<Range, Stack>::call(*stack.car.first, stack);
+ return segmented_begin_impl<Sequence, Stack>::call(*stack.car.first, stack);
}
};
@@ -210,7 +210,7 @@
//auto segmented_next_impl(stack)
//{
- // // car(stack) is a range of values, not a range of segments
+ // // car(stack) is a seq of values, not a seq of segments
// auto next = pop_front_car(stack);
// if (is_invalid(next))
// return segmented_next_impl_recurse(cdr(next));
Modified: trunk/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp
==============================================================================
--- trunk/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp (original)
+++ trunk/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -12,24 +12,24 @@
namespace boost { namespace fusion { namespace detail
{
- //auto segmented_begin( rng )
+ //auto segmented_begin( seq )
//{
- // return make_segmented_iterator( segmented_begin_impl( rng, nil ) );
+ // return make_segmented_iterator( segmented_begin_impl( seq, nil ) );
//}
- template<typename Range>
+ template <typename Sequence>
struct segmented_begin
{
typedef
segmented_iterator<
- typename segmented_begin_impl<Range, fusion::nil>::type
+ typename segmented_begin_impl<Sequence, fusion::nil>::type
>
type;
- static type call(Range & rng)
+ static type call(Sequence& seq)
{
return type(
- segmented_begin_impl<Range, fusion::nil>::call(rng, fusion::nil()));
+ segmented_begin_impl<Sequence, fusion::nil>::call(seq, fusion::nil()));
}
};
Modified: trunk/boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp
==============================================================================
--- trunk/boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp (original)
+++ trunk/boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -27,80 +27,80 @@
template <typename Sig>
struct result;
- template <typename This, typename Range, typename State, typename Context>
- struct result<This(Range&, State&, Context&)>
+ template <typename This, typename Sequence, typename State, typename Context>
+ struct result<This(Sequence&, State&, Context&)>
{
typedef
iterator_range<
- typename fusion::result_of::begin<Range>::type,
- typename fusion::result_of::end<Range>::type
+ typename fusion::result_of::begin<Sequence>::type
+ , typename fusion::result_of::end<Sequence>::type
>
range_type;
typedef
fusion::result<
- cons<range_type, typename remove_const<Context>::type>,
- fusion::break_
+ cons<range_type, typename remove_const<Context>::type>
+ , fusion::break_
>
type;
};
- template <typename Range, typename State, typename Context>
- typename result<segmented_begin_fun(Range&, State const&, Context const&)>::type
- operator()(Range& rng, State const&, Context const& context) const
+ template <typename Sequence, typename State, typename Context>
+ typename result<segmented_begin_fun(Sequence&, State const&, Context const&)>::type
+ operator()(Sequence& seq, State const&, Context const& context) const
{
typedef
iterator_range<
- typename fusion::result_of::begin<Range>::type,
- typename fusion::result_of::end<Range>::type
+ typename fusion::result_of::begin<Sequence>::type
+ , typename fusion::result_of::end<Sequence>::type
>
range_type;
- return cons<range_type, Context>(range_type(fusion::begin(rng), fusion::end(rng)), context);
+ return cons<range_type, Context>(range_type(fusion::begin(seq), fusion::end(seq)), context);
}
};
- template <typename Range, typename Stack, bool IsSegmented = traits::is_segmented<Range>::type::value>
+ template <typename Sequence, typename Stack, bool IsSegmented = traits::is_segmented<Sequence>::type::value>
struct segmented_begin_impl_aux
{
typedef
- segmented_end_impl<Range, Stack>
+ segmented_end_impl<Sequence, Stack>
end_impl;
typedef
segmented_fold_until_impl<
- Range,
- result<typename end_impl::type, continue_>,
- Stack,
- segmented_begin_fun
+ Sequence
+ , result<typename end_impl::type, continue_>
+ , Stack
+ , segmented_begin_fun
>
fold_impl;
typedef typename fold_impl::type::value_type type;
- static type call(Range& rng, Stack const& stack)
+ static type call(Sequence& seq, Stack const& stack)
{
- return fold_impl::call(rng, end_impl::call(rng, stack), stack, segmented_begin_fun()).value;
+ return fold_impl::call(seq, end_impl::call(seq, stack), stack, segmented_begin_fun()).value;
}
};
- template <typename Range, typename Stack>
- struct segmented_begin_impl_aux<Range, Stack, false>
+ template <typename Sequence, typename Stack>
+ struct segmented_begin_impl_aux<Sequence, Stack, false>
{
- typedef typename result_of::begin<Range>::type begin_type;
- typedef typename result_of::end<Range>::type end_type;
+ typedef typename result_of::begin<Sequence>::type begin_type;
+ typedef typename result_of::end<Sequence>::type end_type;
typedef iterator_range<begin_type, end_type> pair_type;
typedef cons<pair_type, Stack> type;
- static type call(Range& rng, Stack stack)
+ static type call(Sequence& seq, Stack stack)
{
- return type(pair_type(fusion::begin(rng), fusion::end(rng)), stack);
+ return type(pair_type(fusion::begin(seq), fusion::end(seq)), stack);
}
};
- template <typename Range, typename Stack>
+ template <typename Sequence, typename Stack>
struct segmented_begin_impl
- : segmented_begin_impl_aux<Range, Stack>
+ : segmented_begin_impl_aux<Sequence, Stack>
{};
}}}
Modified: trunk/boost/fusion/sequence/intrinsic/detail/segmented_end.hpp
==============================================================================
--- trunk/boost/fusion/sequence/intrinsic/detail/segmented_end.hpp (original)
+++ trunk/boost/fusion/sequence/intrinsic/detail/segmented_end.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -13,24 +13,24 @@
namespace boost { namespace fusion { namespace detail
{
- //auto segmented_end( rng )
+ //auto segmented_end( seq )
//{
- // return make_segmented_iterator( segmented_end_impl( rng ) );
+ // return make_segmented_iterator( segmented_end_impl( seq ) );
//}
- template<typename Range>
+ template <typename Sequence>
struct segmented_end
{
typedef
segmented_iterator<
- typename segmented_end_impl<Range, fusion::nil>::type
+ typename segmented_end_impl<Sequence, fusion::nil>::type
>
type;
- static type call(Range & rng)
+ static type call(Sequence & seq)
{
return type(
- segmented_end_impl<Range, fusion::nil>::call(rng, fusion::nil()));
+ segmented_end_impl<Sequence, fusion::nil>::call(seq, fusion::nil()));
}
};
Modified: trunk/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp
==============================================================================
--- trunk/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp (original)
+++ trunk/boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -22,23 +22,23 @@
namespace boost { namespace fusion { namespace detail
{
- //auto segmented_end_impl( rng, stack )
+ //auto segmented_end_impl( seq, stack )
//{
- // assert(is_segmented(rng));
- // auto it = end(segments(rng));
+ // assert(is_segmented(seq));
+ // auto it = end(segments(seq));
// return cons(iterator_range(it, it), stack);
//}
- template<typename Range, typename Stack>
+ template <typename Sequence, typename Stack>
struct segmented_end_impl
{
- BOOST_MPL_ASSERT((traits::is_segmented<Range>));
+ BOOST_MPL_ASSERT((traits::is_segmented<Sequence>));
typedef
typename result_of::end<
typename remove_reference<
typename add_const<
- typename result_of::segments<Range>::type
+ typename result_of::segments<Sequence>::type
>::type
>::type
>::type
@@ -47,9 +47,9 @@
typedef iterator_range<end_type, end_type> pair_type;
typedef cons<pair_type, Stack> type;
- static type call(Range & rng, Stack stack)
+ static type call(Sequence & seq, Stack stack)
{
- end_type end = fusion::end(fusion::segments(rng));
+ end_type end = fusion::end(fusion::segments(seq));
return type(pair_type(end, end), stack);
}
};
Modified: trunk/boost/fusion/sequence/intrinsic/detail/segmented_size.hpp
==============================================================================
--- trunk/boost/fusion/sequence/intrinsic/detail/segmented_size.hpp (original)
+++ trunk/boost/fusion/sequence/intrinsic/detail/segmented_size.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -28,14 +28,14 @@
///////////////////////////////////////////////////////////////////////////
template<typename Sequence, bool IsSegmented = traits::is_segmented<Sequence>::value>
struct segmented_size_impl
- : mpl::fold<
+ : mpl::fold<
typename remove_reference<
typename add_const<
typename result_of::segments<Sequence>::type
>::type
- >::type,
- mpl::size_t<0>,
- mpl::plus<mpl::_1, segmented_size<mpl::_2> >
+ >::type
+ , mpl::size_t<0>
+ , mpl::plus<mpl::_1, segmented_size<mpl::_2> >
>::type
{};
Modified: trunk/boost/fusion/support/detail/segmented_fold_until_impl.hpp
==============================================================================
--- trunk/boost/fusion/support/detail/segmented_fold_until_impl.hpp (original)
+++ trunk/boost/fusion/support/detail/segmented_fold_until_impl.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -24,8 +24,8 @@
#include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/sequence/intrinsic/segments.hpp>
-// fun(rng, state, context)
-// rng: a non-segmented range
+// fun(seq, state, context)
+// seq: a non-segmented range
// state: the state of the fold so far
// context: the path to the current range
//
@@ -46,8 +46,8 @@
{
typedef
iterator_range<
- Cur,
- typename result_of::end<
+ Cur
+ , typename result_of::end<
typename remove_reference<
typename add_const<
typename result_of::deref<
@@ -118,31 +118,31 @@
namespace detail
{
template <
- typename Begin,
- typename End,
- typename State,
- typename Context,
- typename Fun,
- bool IsEmpty = result_of::empty<
+ typename Begin
+ , typename End
+ , typename State
+ , typename Context
+ , typename Fun
+ , bool IsEmpty = result_of::empty<
typename result_of::value_of<Begin>::type
>::type::value>
struct segmented_fold_until_iterate_skip_empty;
template <
- typename Begin,
- typename End,
- typename State,
- typename Context,
- typename Fun,
- bool IsDone = result_of::equal_to<Begin, End>::type::value>
+ typename Begin
+ , typename End
+ , typename State
+ , typename Context
+ , typename Fun
+ , bool IsDone = result_of::equal_to<Begin, End>::type::value>
struct segmented_fold_until_iterate;
template <
- typename Range,
- typename State,
- typename Context,
- typename Fun,
- bool IsSegmented = traits::is_segmented<Range>::type::value>
+ typename Sequence
+ , typename State
+ , typename Context
+ , typename Fun
+ , bool IsSegmented = traits::is_segmented<Sequence>::type::value>
struct segmented_fold_until_impl;
template <typename Segments, typename State, typename Context, typename Fun>
@@ -170,65 +170,65 @@
// return segmented_iterator(push_context(cur, end, context));
//}
//
- //auto segmented_fold_until_impl(rng, state, context, fun)
+ //auto segmented_fold_until_impl(seq, state, context, fun)
//{
- // if (is_segmented(rng))
+ // if (is_segmented(seq))
// {
- // segmented_fold_until_on_segments(segments(rng), state, context, fun);
+ // segmented_fold_until_on_segments(segments(seq), state, context, fun);
// }
// else
// {
- // return fun(rng, state, context);
+ // return fun(seq, state, context);
// }
//}
template <
- typename Range,
- typename State,
- typename Context,
- typename Fun,
- bool IsSegmented>
+ typename Sequence
+ , typename State
+ , typename Context
+ , typename Fun
+ , bool IsSegmented>
struct segmented_fold_until_impl
{
typedef
segmented_fold_until_on_segments<
typename remove_reference<
typename add_const<
- typename result_of::segments<Range>::type
+ typename result_of::segments<Sequence>::type
>::type
- >::type,
- State,
- Context,
- Fun
+ >::type
+ , State
+ , Context
+ , Fun
>
impl;
typedef typename impl::type type;
- static type call(Range& rng, State const& state, Context const& context, Fun const& fun)
+ static type call(Sequence& seq, State const& state, Context const& context, Fun const& fun)
{
- return impl::call(fusion::segments(rng), state, context, fun);
+ return impl::call(fusion::segments(seq), state, context, fun);
}
};
template <
- typename Range,
- typename State,
- typename Context,
- typename Fun>
- struct segmented_fold_until_impl<Range, State, Context, Fun, false>
+ typename Sequence
+ , typename State
+ , typename Context
+ , typename Fun>
+ struct segmented_fold_until_impl<Sequence, State, Context, Fun, false>
{
typedef
typename boost::result_of<Fun(
- Range&,
- typename add_reference<typename add_const<typename State::value_type>::type>::type,
- Context const&
+ Sequence&
+ , typename add_reference<typename add_const<typename State::value_type>::type>::type
+ , Context const&
)>::type
type;
- static type call(Range& rng, State const& state, Context const& context, Fun const& fun)
+ static type call(Sequence& seq, State const& state, Context const& context, Fun const& fun)
{
- return fun(rng, state.value, context);
+ return fun(seq, state.value, context);
}
};
@@ -264,10 +264,10 @@
typename add_const<
typename result_of::deref<Begin>::type
>::type
- >::type,
- State,
- next_context_type,
- Fun
+ >::type
+ , State
+ , next_context_type
+ , Fun
>
fold_recurse_impl;
@@ -277,51 +277,51 @@
typedef
segmented_fold_until_iterate<
- typename result_of::next<Begin>::type,
- End,
- next_state_type,
- Context,
- Fun
+ typename result_of::next<Begin>::type
+ , End
+ , next_state_type
+ , Context
+ , Fun
>
next_iteration_impl;
typedef
typename mpl::eval_if<
- typename next_state_type::continue_type,
- next_iteration_impl,
- mpl::identity<next_state_type>
+ typename next_state_type::continue_type
+ , next_iteration_impl
+ , mpl::identity<next_state_type>
>::type
type;
- static type call(Begin const& beg, End const& end, State const& state,
- Context const& context, Fun const& fun)
+ static type call(Begin const& beg, End const& end, State const& state
+ , Context const& context, Fun const& fun)
{
return call(beg, end, state, context, fun, typename next_state_type::continue_type());
}
- static type call(Begin const& beg, End const& end, State const& state,
- Context const& context, Fun const& fun, mpl::true_) // continue
+ static type call(Begin const& beg, End const& end, State const& state
+ , Context const& context, Fun const& fun, mpl::true_) // continue
{
return next_iteration_impl::call(
- fusion::next(beg),
- end,
- fold_recurse_impl::call(
- *beg,
- state,
- push_context_impl::call(beg, end, context),
- fun),
- context,
- fun);
+ fusion::next(beg)
+ , end
+ , fold_recurse_impl::call(
+ *beg
+ , state
+ , push_context_impl::call(beg, end, context)
+ , fun)
+ , context
+ , fun);
}
- static type call(Begin const& beg, End const& end, State const& state,
- Context const& context, Fun const& fun, mpl::false_) // break
+ static type call(Begin const& beg, End const& end, State const& state
+ , Context const& context, Fun const& fun, mpl::false_) // break
{
return fold_recurse_impl::call(
- *beg,
- state,
- push_context_impl::call(beg, end, context),
- fun);
+ *beg
+ , state
+ , push_context_impl::call(beg, end, context)
+ , fun);
}
};
@@ -330,18 +330,18 @@
{
typedef
segmented_fold_until_iterate<
- typename result_of::next<Begin>::type,
- End,
- State,
- Context,
- Fun
+ typename result_of::next<Begin>::type
+ , End
+ , State
+ , Context
+ , Fun
>
impl;
typedef typename impl::type type;
- static type call(Begin const& beg, End const& end, State const& state,
- Context const& context, Fun const& fun)
+ static type call(Begin const& beg, End const& end, State const& state
+ , Context const& context, Fun const& fun)
{
return impl::call(fusion::next(beg), end, state, context, fun);
}
@@ -356,8 +356,8 @@
typedef typename impl::type type;
- static type call(Begin const& beg, End const& end, State const& state,
- Context const& context, Fun const& fun)
+ static type call(Begin const& beg, End const& end, State const& state
+ , Context const& context, Fun const& fun)
{
return impl::call(beg, end, state, context, fun);
}
@@ -368,8 +368,8 @@
{
typedef State type;
- static type call(Begin const&, End const&, State const& state,
- Context const&, Fun const&)
+ static type call(Begin const&, End const&, State const& state
+ , Context const&, Fun const&)
{
return state;
}
@@ -380,11 +380,11 @@
{
typedef
segmented_fold_until_iterate<
- typename result_of::begin<Segments>::type,
- typename result_of::end<Segments>::type,
- State,
- Context,
- Fun
+ typename result_of::begin<Segments>::type
+ , typename result_of::end<Segments>::type
+ , State
+ , Context
+ , Fun
>
impl;
Modified: trunk/boost/fusion/support/segmented_fold_until.hpp
==============================================================================
--- trunk/boost/fusion/support/segmented_fold_until.hpp (original)
+++ trunk/boost/fusion/support/segmented_fold_until.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -7,6 +7,8 @@
#if !defined(BOOST_FUSION_SEGMENTED_FOLD_UNTIL_HPP_INCLUDED)
#define BOOST_FUSION_SEGMENTED_FOLD_UNTIL_HPP_INCLUDED
+#include <boost/type_traits/is_const.hpp>
+#include <boost/utility/enable_if.hpp>
#include <boost/fusion/support/detail/segmented_fold_until_impl.hpp>
#include <boost/fusion/view/iterator_range.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
@@ -16,45 +18,56 @@
namespace boost { namespace fusion
{
- //auto segmented_fold_until(rng, state, fun)
+ //auto segmented_fold_until(seq, state, fun)
//{
- // return first(segmented_fold_until_impl(rng, state, nil, fun));
+ // return first(segmented_fold_until_impl(seq, state, nil, fun));
//}
namespace result_of
{
- template <typename Range, typename State, typename Fun>
+ template <typename Sequence, typename State, typename Fun>
struct segmented_fold_until
{
typedef
detail::segmented_fold_until_impl<
- Range,
- result<State, continue_>,
- fusion::nil,
- Fun
+ Sequence
+ , result<State, continue_>
+ , fusion::nil
+ , Fun
>
- impl;
+ filter;
typedef
- typename impl::type::value_type
+ typename filter::type::value_type
type;
};
}
- template <typename Range, typename State, typename Fun>
- typename result_of::segmented_fold_until<Range, State, Fun>::type
- segmented_fold_until(Range& rng, State const& state, Fun const& fun)
+ template <typename Sequence, typename State, typename Fun>
+ typename
+ lazy_disable_if<
+ is_const<Sequence>
+ , result_of::segmented_fold_until<Sequence, State, Fun>
+ >::type
+ segmented_fold_until(Sequence& seq, State const& state, Fun const& fun)
{
- typedef typename result_of::segmented_fold_until<Range, State, Fun>::impl impl;
- return impl::call(rng, state, fusion::nil(), fun).value;
+ typedef
+ typename result_of::segmented_fold_until<Sequence, State, Fun>::filter
+ filter;
+
+ return filter::call(seq, state, fusion::nil(), fun).value;
}
- template <typename Range, typename State, typename Fun>
- typename result_of::segmented_fold_until<Range const, State, Fun>::type
- segmented_fold_until(Range const& rng, State const& state, Fun const& fun)
+ template <typename Sequence, typename State, typename Fun>
+ typename result_of::segmented_fold_until<Sequence const, State, Fun>::type
+ segmented_fold_until(Sequence const& seq, State const& state, Fun const& fun)
{
- typedef typename result_of::segmented_fold_until<Range const, State, Fun>::impl impl;
- return impl::call(rng, state, fusion::nil(), fun).value;
+ typedef
+ typename result_of::segmented_fold_until<Sequence const, State, Fun>::filter
+ filter;
+
+ return filter::call(seq, state, fusion::nil(), fun).value;
}
}}
+
#endif
Modified: trunk/boost/fusion/view/filter_view/detail/next_impl.hpp
==============================================================================
--- trunk/boost/fusion/view/filter_view/detail/next_impl.hpp (original)
+++ trunk/boost/fusion/view/filter_view/detail/next_impl.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -65,7 +65,7 @@
static type
call(Iterator const& i)
{
- return type(filter::call(i.first));
+ return type(filter::iter_call(i.first));
}
};
};
Modified: trunk/boost/fusion/view/filter_view/filter_view_iterator.hpp
==============================================================================
--- trunk/boost/fusion/view/filter_view/filter_view_iterator.hpp (original)
+++ trunk/boost/fusion/view/filter_view/filter_view_iterator.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -55,7 +55,7 @@
typedef Pred pred_type;
filter_iterator(First const& in_first)
- : first(filter::call(first_converter::call(in_first))) {}
+ : first(filter::iter_call(first_converter::call(in_first))) {}
first_type first;
Modified: trunk/boost/fusion/view/iterator_range/detail/is_segmented_impl.hpp
==============================================================================
--- trunk/boost/fusion/view/iterator_range/detail/is_segmented_impl.hpp (original)
+++ trunk/boost/fusion/view/iterator_range/detail/is_segmented_impl.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -53,9 +53,9 @@
: is_segmented_iterator<typename Sequence::begin_type>
{
BOOST_MPL_ASSERT_RELATION(
- is_segmented_iterator<typename Sequence::begin_type>::value,
- ==,
- is_segmented_iterator<typename Sequence::end_type>::value);
+ is_segmented_iterator<typename Sequence::begin_type>::value
+ , ==
+ , is_segmented_iterator<typename Sequence::end_type>::value);
};
};
}
Modified: trunk/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp
==============================================================================
--- trunk/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp (original)
+++ trunk/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -82,16 +82,16 @@
>::type
>::type
>::type
- >::type,
- typename Stack::cdr_type::car_type::end_type
+ >::type
+ , typename Stack::cdr_type::car_type::end_type
>));
typedef
iterator_range<
typename result_of::next<
typename Stack::cdr_type::car_type::begin_type
- >::type,
- typename result_of::end<
+ >::type
+ , typename result_of::end<
typename remove_reference<
typename add_const<
typename result_of::segments<
@@ -116,8 +116,8 @@
typedef
segment_sequence<
typename result_of::push_front<
- rest_type const,
- typename recurse::type
+ rest_type const
+ , typename recurse::type
>::type
>
type;
@@ -130,8 +130,8 @@
// make_segment_sequence_front(cdr(stack_begin))));
return type(
fusion::push_front(
- rest_type(fusion::next(stack.cdr.car.first), fusion::end(fusion::segments(*stack.car.first))),
- recurse::call(stack.cdr)));
+ rest_type(fusion::next(stack.cdr.car.first), fusion::end(fusion::segments(*stack.car.first)))
+ , recurse::call(stack.cdr)));
}
};
@@ -149,14 +149,14 @@
>::type
>::type
>::type
- >::type,
- typename Stack::cdr_type::car_type::end_type
+ >::type
+ , typename Stack::cdr_type::car_type::end_type
>));
typedef
iterator_range<
- typename Stack::cdr_type::car_type::begin_type,
- typename result_of::end<
+ typename Stack::cdr_type::car_type::begin_type
+ , typename result_of::end<
typename remove_reference<
typename add_const<
typename result_of::deref<
@@ -226,8 +226,8 @@
>::type
>::type
>::type
- >::type,
- typename Stack::cdr_type::car_type::end_type
+ >::type
+ , typename Stack::cdr_type::car_type::end_type
>));
typedef
@@ -246,8 +246,8 @@
>::type
>::type
>::type
- >::type,
- typename Stack::cdr_type::car_type::begin_type
+ >::type
+ , typename Stack::cdr_type::car_type::begin_type
>
rest_type;
@@ -258,8 +258,8 @@
typedef
segment_sequence<
typename result_of::push_back<
- rest_type const,
- typename recurse::type
+ rest_type const
+ , typename recurse::type
>::type
>
type;
@@ -272,8 +272,8 @@
// make_segment_sequence_back(cdr(stack_end))));
return type(
fusion::push_back(
- rest_type(fusion::begin(fusion::segments(*stack.car.first)), stack.cdr.car.first),
- recurse::call(stack.cdr)));
+ rest_type(fusion::begin(fusion::segments(*stack.car.first)), stack.cdr.car.first)
+ , recurse::call(stack.cdr)));
}
};
@@ -291,8 +291,8 @@
>::type
>::type
>::type
- >::type,
- typename Stack::cdr_type::car_type::end_type
+ >::type
+ , typename Stack::cdr_type::car_type::end_type
>));
typedef
@@ -305,8 +305,8 @@
>::type
>::type
>::type
- >::type,
- typename Stack::cdr_type::car_type::begin_type
+ >::type
+ , typename Stack::cdr_type::car_type::begin_type
>
type;
@@ -362,19 +362,19 @@
//}
template <
- typename StackBegin,
- typename StackEnd,
- int StackBeginSize = StackBegin::size::value,
- int StackEndSize = StackEnd::size::value>
+ typename StackBegin
+ , typename StackEnd
+ , int StackBeginSize = StackBegin::size::value
+ , int StackEndSize = StackEnd::size::value>
struct make_segmented_range_reduce;
template <
- typename StackBegin,
- typename StackEnd,
- bool SameSegment =
+ typename StackBegin
+ , typename StackEnd
+ , bool SameSegment =
result_of::equal_to<
- typename StackBegin::car_type::begin_type,
- typename StackEnd::car_type::begin_type
+ typename StackBegin::car_type::begin_type
+ , typename StackEnd::car_type::begin_type
>::type::value>
struct make_segmented_range_reduce2
{
@@ -382,8 +382,8 @@
iterator_range<
typename result_of::next<
typename StackBegin::car_type::begin_type
- >::type,
- typename StackEnd::car_type::begin_type
+ >::type
+ , typename StackEnd::car_type::begin_type
>
rest_type;
@@ -391,10 +391,10 @@
segment_sequence<
typename result_of::push_back<
typename result_of::push_front<
- rest_type const,
- typename make_segment_sequence_front<StackBegin>::type
- >::type const,
- typename make_segment_sequence_back<StackEnd>::type
+ rest_type const
+ , typename make_segment_sequence_front<StackBegin>::type
+ >::type const
+ , typename make_segment_sequence_back<StackEnd>::type
>::type
>
type;
@@ -412,9 +412,9 @@
return type(
fusion::push_back(
fusion::push_front(
- rest_type(fusion::next(stack_begin.car.first), stack_end.car.first),
- make_segment_sequence_front<StackBegin>::call(stack_begin)),
- make_segment_sequence_back<StackEnd>::call(stack_end)));
+ rest_type(fusion::next(stack_begin.car.first), stack_end.car.first)
+ , make_segment_sequence_front<StackBegin>::call(stack_begin))
+ , make_segment_sequence_back<StackEnd>::call(stack_end)));
}
};
@@ -423,8 +423,8 @@
{
typedef
make_segmented_range_reduce<
- typename StackBegin::cdr_type,
- typename StackEnd::cdr_type
+ typename StackBegin::cdr_type
+ , typename StackEnd::cdr_type
>
impl;
@@ -448,8 +448,8 @@
{
typedef
iterator_range<
- typename StackBegin::car_type::begin_type,
- typename StackEnd::car_type::begin_type
+ typename StackBegin::car_type::begin_type
+ , typename StackEnd::car_type::begin_type
>
range_type;
@@ -483,8 +483,8 @@
typedef
make_segmented_range_reduce<
- typename reverse_begin_cons::type,
- typename reverse_end_cons::type
+ typename reverse_begin_cons::type
+ , typename reverse_end_cons::type
>
impl;
@@ -493,8 +493,8 @@
static type call(Begin const & begin, End const & end)
{
return impl::call(
- reverse_begin_cons::call(begin.context),
- reverse_end_cons::call(end.context));
+ reverse_begin_cons::call(begin.context)
+ , reverse_end_cons::call(end.context));
}
};
Modified: trunk/boost/fusion/view/iterator_range/detail/segments_impl.hpp
==============================================================================
--- trunk/boost/fusion/view/iterator_range/detail/segments_impl.hpp (original)
+++ trunk/boost/fusion/view/iterator_range/detail/segments_impl.hpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -29,8 +29,8 @@
{
typedef
detail::make_segmented_range<
- typename Sequence::begin_type,
- typename Sequence::end_type
+ typename Sequence::begin_type
+ , typename Sequence::end_type
>
impl;
Modified: trunk/libs/fusion/test/algorithm/segmented_find.cpp
==============================================================================
--- trunk/libs/fusion/test/algorithm/segmented_find.cpp (original)
+++ trunk/libs/fusion/test/algorithm/segmented_find.cpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -7,7 +7,7 @@
==============================================================================*/
#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/container/vector/vector.hpp>
-#include <boost/fusion/algorithm/query/ext_/find_s.hpp>
+#include <boost/fusion/algorithm/query/find.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include "../sequence/tree.hpp"
@@ -19,21 +19,21 @@
{
using namespace boost;
- typedef typename boost::fusion::result_of::find_s<Tree const, short>::type short_iter;
- typedef typename boost::fusion::result_of::find_s<Tree const, float>::type float_iter;
- typedef typename boost::fusion::result_of::find_s<Tree const, not_there>::type not_there_iter;
+ typedef typename boost::fusion::result_of::find<Tree const, short>::type short_iter;
+ typedef typename boost::fusion::result_of::find<Tree const, float>::type float_iter;
+ typedef typename boost::fusion::result_of::find<Tree const, not_there>::type not_there_iter;
// find_if_s of a segmented data structure returns generic
// segmented iterators
- short_iter si = fusion::find_s<short>(tree);
- float_iter fi = fusion::find_s<float>(tree);
+ short_iter si = fusion::find<short>(tree);
+ float_iter fi = fusion::find<float>(tree);
// they behave like ordinary Fusion iterators ...
BOOST_TEST((*si == short('d')));
BOOST_TEST((*fi == float(1)));
// Searching for something that's not there should return the end iterator.
- not_there_iter nti = fusion::find_s<not_there>(tree);
+ not_there_iter nti = fusion::find<not_there>(tree);
BOOST_TEST((nti == fusion::end(tree)));
}
Modified: trunk/libs/fusion/test/algorithm/segmented_find_if.cpp
==============================================================================
--- trunk/libs/fusion/test/algorithm/segmented_find_if.cpp (original)
+++ trunk/libs/fusion/test/algorithm/segmented_find_if.cpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -7,7 +7,7 @@
==============================================================================*/
#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/container/vector/vector.hpp>
-#include <boost/fusion/algorithm/query/ext_/find_if_s.hpp>
+#include <boost/fusion/algorithm/query/find_if.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/type_traits/is_same.hpp>
@@ -22,21 +22,21 @@
using namespace boost;
using mpl::_;
- typedef typename boost::fusion::result_of::find_if_s<Tree const, is_same<_,short> >::type short_iter;
- typedef typename boost::fusion::result_of::find_if_s<Tree const, is_same<_,float> >::type float_iter;
- typedef typename boost::fusion::result_of::find_if_s<Tree const, is_same<_,not_there> >::type not_there_iter;
+ typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,short> >::type short_iter;
+ typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,float> >::type float_iter;
+ typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,not_there> >::type not_there_iter;
- // find_if_s of a segmented data structure returns generic
+ // find_if of a segmented data structure returns generic
// segmented iterators
- short_iter si = fusion::find_if_s<is_same<_,short> >(tree);
- float_iter fi = fusion::find_if_s<is_same<_,float> >(tree);
+ short_iter si = fusion::find_if<is_same<_,short> >(tree);
+ float_iter fi = fusion::find_if<is_same<_,float> >(tree);
// they behave like ordinary Fusion iterators ...
BOOST_TEST((*si == short('d')));
BOOST_TEST((*fi == float(1)));
// Searching for something that's not there should return the end iterator.
- not_there_iter nti = fusion::find_if_s<is_same<_,not_there> >(tree);
+ not_there_iter nti = fusion::find_if<is_same<_,not_there> >(tree);
BOOST_TEST((nti == fusion::end(tree)));
}
Modified: trunk/libs/fusion/test/sequence/segmented_iterator_range.cpp
==============================================================================
--- trunk/libs/fusion/test/sequence/segmented_iterator_range.cpp (original)
+++ trunk/libs/fusion/test/sequence/segmented_iterator_range.cpp 2011-08-18 13:12:05 EDT (Thu, 18 Aug 2011)
@@ -8,7 +8,7 @@
#include <sstream>
#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/algorithm/iteration/ext_/for_each_s.hpp>
-#include <boost/fusion/algorithm/query/ext_/find_if_s.hpp>
+#include <boost/fusion/algorithm/query/find_if.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/view/iterator_range/iterator_range.hpp>
@@ -43,16 +43,16 @@
using namespace fusion;
using mpl::_;
- typedef typename boost::fusion::result_of::find_if_s<Tree const, is_same<_,short> >::type short_iter;
- typedef typename boost::fusion::result_of::find_if_s<Tree const, is_same<_,float> >::type float_iter;
+ typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,short> >::type short_iter;
+ typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,float> >::type float_iter;
typedef iterator_range<short_iter, float_iter> slice_t;
BOOST_STATIC_ASSERT(traits::is_segmented<slice_t>::value);
- // find_if_s of a segmented data structure returns generic
+ // find_if of a segmented data structure returns generic
// segmented iterators
- short_iter si = find_if_s<is_same<_,short> >(tree);
- float_iter fi = find_if_s<is_same<_,float> >(tree);
+ short_iter si = find_if<is_same<_,short> >(tree);
+ float_iter fi = find_if<is_same<_,float> >(tree);
// If you put them in an iterator range, the range
// is automatically a segmented data structure.
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