Removed file/folder

[SVN r40230]
This commit is contained in:
Joel de Guzman
2007-10-20 23:49:46 +00:00
parent 66cc9bbc28
commit 13b01b0bfe
474 changed files with 0 additions and 25526 deletions

View File

@ -1,34 +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)
==============================================================================*/
#if !defined(BOOST_FUSION_ALL_05052005_1238)
#define BOOST_FUSION_ALL_05052005_1238
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/algorithm/query/detail/all.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence, typename F>
struct all
{
typedef bool type;
};
}
template <typename Sequence, typename F>
inline bool
all(Sequence const& seq, F f)
{
return detail::all(seq, f, typename traits::category_of<Sequence>::type());
}
}}
#endif

View File

@ -1,35 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005 Eric Niebler
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)
==============================================================================*/
#if !defined(FUSION_ANY_05052005_1230)
#define FUSION_ANY_05052005_1230
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/algorithm/query/detail/any.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence, typename F>
struct any
{
typedef bool type;
};
}
template <typename Sequence, typename F>
inline bool
any(Sequence const& seq, F f)
{
return detail::any(seq, f, typename traits::category_of<Sequence>::type());
}
}}
#endif

View File

@ -1,35 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2007
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_COUNT_09162005_0150)
#define BOOST_FUSION_COUNT_09162005_0150
#include <boost/fusion/algorithm/query/count_if.hpp>
#include <boost/fusion/algorithm/query/detail/count.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence, typename F>
struct count
{
typedef int type;
};
}
template <typename Sequence, typename T>
inline int
count(Sequence const& seq, T const& x)
{
detail::count_compare<T> f(x);
return fusion::count_if(seq, f);
}
}}
#endif

View File

@ -1,35 +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)
==============================================================================*/
#if !defined(BOOST_FUSION_COUNT_IF_09162005_0137)
#define BOOST_FUSION_COUNT_IF_09162005_0137
#include <boost/fusion/algorithm/query/detail/count_if.hpp>
#include <boost/fusion/support/category_of.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence, typename F>
struct count_if
{
typedef int type;
};
}
template <typename Sequence, typename F>
inline int
count_if(Sequence const& seq, F f)
{
return detail::count_if(
seq, f, typename traits::category_of<Sequence>::type());
}
}}
#endif

View File

@ -1,127 +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)
==============================================================================*/
#if !defined(FUSION_ALL_05052005_1237)
#define FUSION_ALL_05052005_1237
#include <boost/mpl/bool.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/fusion/iterator/distance.hpp>
namespace boost { namespace fusion { namespace detail
{
template <typename First, typename Last, typename F>
inline bool
linear_all(First const&, Last const&, F const&, mpl::true_)
{
return true;
}
template <typename First, typename Last, typename F>
inline bool
linear_all(First const& first, Last const& last, F& f, mpl::false_)
{
typename result_of::deref<First>::type x = *first;
return f(x) &&
detail::linear_all(
fusion::next(first)
, last
, f
, result_of::equal_to<typename result_of::next<First>::type, Last>());
}
template <typename Sequence, typename F, typename Tag>
inline bool
all(Sequence const& seq, F f, Tag)
{
return detail::linear_all(
fusion::begin(seq)
, fusion::end(seq)
, f
, result_of::equal_to<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type>());
}
template<int N>
struct unrolled_all
{
template <typename It, typename F>
static bool call(It const& it, F f)
{
return
f(*it) &&
f(*fusion::advance_c<1>(it))&&
f(*fusion::advance_c<2>(it)) &&
f(*fusion::advance_c<3>(it)) &&
detail::unrolled_all<N-4>::call(fusion::advance_c<4>(it), f);
}
};
template<>
struct unrolled_all<3>
{
template <typename It, typename F>
static bool call(It const& it, F f)
{
return
f(*it) &&
f(*fusion::advance_c<1>(it)) &&
f(*fusion::advance_c<2>(it));
}
};
template<>
struct unrolled_all<2>
{
template <typename It, typename F>
static bool call(It const& it, F f)
{
return
f(*it) &&
f(*fusion::advance_c<1>(it));
}
};
template<>
struct unrolled_all<1>
{
template <typename It, typename F>
static bool call(It const& it, F f)
{
return f(*it);
}
};
template<>
struct unrolled_all<0>
{
template <typename It, typename F>
static bool call(It const& it, F f)
{
return false;
}
};
template <typename Sequence, typename F>
inline bool
all(Sequence const& seq, F f, random_access_traversal_tag)
{
typedef typename result_of::begin<Sequence>::type begin;
typedef typename result_of::end<Sequence>::type end;
return detail::unrolled_all<result_of::distance<begin, end>::type::value>::call(
fusion::begin(seq), f);
}
}}}
#endif

View File

@ -1,130 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005 Eric Niebler
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)
==============================================================================*/
#if !defined(FUSION_ANY_05052005_1229)
#define FUSION_ANY_05052005_1229
#include <boost/mpl/bool.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/fusion/iterator/distance.hpp>
namespace boost { namespace fusion {
struct random_access_traversal_tag;
namespace detail
{
template <typename First, typename Last, typename F>
inline bool
linear_any(First const&, Last const&, F const&, mpl::true_)
{
return false;
}
template <typename First, typename Last, typename F>
inline bool
linear_any(First const& first, Last const& last, F& f, mpl::false_)
{
typename result_of::deref<First>::type x = *first;
return f(x) ||
detail::linear_any(
fusion::next(first)
, last
, f
, result_of::equal_to<typename result_of::next<First>::type, Last>());
}
template <typename Sequence, typename F, typename Tag>
inline bool
any(Sequence const& seq, F f, Tag)
{
return detail::linear_any(
fusion::begin(seq)
, fusion::end(seq)
, f
, result_of::equal_to<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type>());
}
template<int N>
struct unrolled_any
{
template <typename It, typename F>
static bool call(It const& it, F f)
{
return
f(*it) ||
f(*fusion::advance_c<1>(it))||
f(*fusion::advance_c<2>(it)) ||
f(*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, F f)
{
return
f(*it) ||
f(*fusion::advance_c<1>(it)) ||
f(*fusion::advance_c<2>(it));
}
};
template<>
struct unrolled_any<2>
{
template <typename It, typename F>
static bool call(It const& it, F f)
{
return
f(*it) ||
f(*fusion::advance_c<1>(it));
}
};
template<>
struct unrolled_any<1>
{
template <typename It, typename F>
static bool call(It const& it, F f)
{
return f(*it);
}
};
template<>
struct unrolled_any<0>
{
template <typename It, typename F>
static bool call(It const& it, F f)
{
return false;
}
};
template <typename Sequence, typename F>
inline bool
any(Sequence const& seq, F f, random_access_traversal_tag)
{
typedef typename result_of::begin<Sequence>::type begin;
typedef typename result_of::end<Sequence>::type end;
return detail::unrolled_any<result_of::distance<begin, end>::type::value>::call(
fusion::begin(seq), f);
}
}}}
#endif

View File

@ -1,35 +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)
==============================================================================*/
#if !defined(FUSION_ASSOC_FIND_09242005_1133)
#define FUSION_ASSOC_FIND_09242005_1133
#include <boost/mpl/identity.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
namespace boost { namespace fusion { namespace detail
{
template <typename Sequence, typename Key>
struct assoc_find
{
typedef typename
mpl::if_<
is_const<Sequence>
, typename Sequence::template meta_find_impl_const<Key>::type
, typename Sequence::template meta_find_impl<Key>::type
>::type
type;
static type
call(Sequence& s)
{
return s.find_impl(mpl::identity<Key>());
}
};
}}}
#endif

View File

@ -1,68 +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)
==============================================================================*/
#if !defined(FUSION_COUNT_09162005_0158)
#define FUSION_COUNT_09162005_0158
#include <boost/mpl/or.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/fusion/support/detail/access.hpp>
namespace boost { namespace fusion { namespace detail
{
template <bool is_convertible>
struct compare_convertible;
// T1 is convertible to T2 or vice versa
template <>
struct compare_convertible<true>
{
template <typename T1, typename T2>
static bool
call(T1 const& x, T2 const& y)
{
return x == y;
}
};
// T1 is NOT convertible to T2 NOR vice versa
template <>
struct compare_convertible<false>
{
template <typename T1, typename T2>
static bool
call(T1 const&, T2 const&)
{
return false;
}
};
template <typename T1>
struct count_compare
{
typedef typename detail::call_param<T1>::type param;
count_compare(param x)
: x(x) {}
template <typename T2>
bool
operator()(T2 const& y)
{
return
compare_convertible<
mpl::or_<
is_convertible<T1, T2>
, is_convertible<T2, T1>
>::value
>::call(x, y);
}
param x;
};
}}}
#endif

View File

@ -1,170 +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)
==============================================================================*/
#if !defined(BOOST_FUSION_COUNT_IF_09162005_0141)
#define BOOST_FUSION_COUNT_IF_09162005_0141
#include <boost/mpl/bool.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.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/distance.hpp>
#include <boost/fusion/iterator/advance.hpp>
namespace boost { namespace fusion {
struct random_access_traversal_tag;
namespace detail
{
template <typename First, typename Last, typename F>
inline int
linear_count_if(First const&, Last const&, F const&, mpl::true_)
{
return 0;
}
template <typename First, typename Last, typename F>
inline int
linear_count_if(First const& first, Last const& last, F& f, mpl::false_)
{
int n =
detail::linear_count_if(
fusion::next(first)
, last
, f
, result_of::equal_to<typename result_of::next<First>::type, Last>());
if (f(*first))
++n;
return n;
}
template <typename Sequence, typename F, typename Tag>
inline int
count_if(Sequence const& seq, F f, Tag)
{
return detail::linear_count_if(
fusion::begin(seq)
, fusion::end(seq)
, f
, result_of::equal_to<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type>());
}
template<int n>
struct unrolled_count_if
{
template<typename I0, typename F>
static int call(I0 const& i0, F f)
{
int ct = unrolled_count_if<n-4>::
call(fusion::advance_c<4>(i0), f);
if(f(*i0))
++ct;
typedef typename result_of::next<I0>::type I1;
I1 i1(fusion::next(i0));
if(f(*i1))
++ct;
typedef typename result_of::next<I1>::type I2;
I2 i2(fusion::next(i1));
if(f(*i2))
++ct;
typedef typename result_of::next<I2>::type I3;
I3 i3(fusion::next(i2));
if(f(*i3))
++ct;
return ct;
}
};
template<>
struct unrolled_count_if<3>
{
template<typename I0, typename F>
static int call(I0 const& i0, F f)
{
int ct = 0;
if(f(*i0))
++ct;
typedef typename result_of::next<I0>::type I1;
I1 i1(fusion::next(i0));
if(f(*i1))
++ct;
typedef typename result_of::next<I1>::type I2;
I2 i2(fusion::next(i1));
if(f(*i2))
++ct;
return ct;
}
};
template<>
struct unrolled_count_if<2>
{
template<typename I0, typename F>
static int call(I0 const& i0, F f)
{
int ct = 0;
if(f(*i0))
++ct;
typedef typename result_of::next<I0>::type I1;
I1 i1(fusion::next(i0));
if(f(*i1))
++ct;
return ct;
}
};
template<>
struct unrolled_count_if<1>
{
template<typename I0, typename F>
static int call(I0 const& i0, F f)
{
int ct = 0;
if(f(*i0))
++ct;
return ct;
}
};
template<>
struct unrolled_count_if<0>
{
template<typename I0, typename F>
static int call(I0 const&, F)
{
return 0;
}
};
template <typename Sequence, typename F>
inline int
count_if(Sequence const& seq, F f, random_access_traversal_tag)
{
typedef typename result_of::begin<Sequence>::type begin;
typedef typename result_of::end<Sequence>::type end;
return detail::unrolled_count_if<result_of::distance<begin, end>::type::value>::
call(fusion::begin(seq), f);
}
}}}
#endif

View File

@ -1,252 +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)
==============================================================================*/
#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/identity.hpp>
#include <boost/fusion/iterator/value_of.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/support/category_of.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
namespace boost { namespace fusion {
struct random_access_traversal_tag;
namespace detail
{
template <typename Iterator, typename Pred>
struct apply_filter
{
typedef typename mpl::apply1<
Pred, typename result_of::value_of<Iterator>::type>::type type;
BOOST_STATIC_CONSTANT(int, value = type::value);
};
template <typename First, typename Last, typename Pred>
struct main_find_if;
template <typename First, typename Last, typename Pred>
struct recursive_find_if
{
typedef typename
main_find_if<
typename result_of::next<First>::type, Last, Pred
>::type
type;
};
template <typename First, typename Last, typename Pred>
struct main_find_if
{
typedef mpl::or_<
result_of::equal_to<First, Last>
, apply_filter<First, Pred> >
filter;
typedef typename
mpl::eval_if<
filter
, mpl::identity<First>
, recursive_find_if<First, Last, Pred>
>::type
type;
};
template<
typename First, typename Last,
typename Pred, bool>
struct choose_find_if;
template<typename First, typename Last, typename Pred>
struct choose_find_if<First, Last, Pred, false>
: main_find_if<First, Last, Pred>
{};
template<typename Iter, typename Pred, int n, int unrolling>
struct unroll_again;
template <typename Iter, typename Pred, int offset>
struct apply_offset_filter
{
typedef typename result_of::advance_c<Iter, offset>::type Shifted;
typedef typename
mpl::apply1<
Pred
, typename result_of::value_of<Shifted>::type
>::type
type;
BOOST_STATIC_CONSTANT(int, value = type::value);
};
template<typename Iter, typename Pred, int n>
struct unrolled_find_if
{
typedef typename mpl::eval_if<
apply_filter<Iter, Pred>,
mpl::identity<Iter>,
mpl::eval_if<
apply_offset_filter<Iter, Pred, 1>,
result_of::advance_c<Iter, 1>,
mpl::eval_if<
apply_offset_filter<Iter, Pred, 2>,
result_of::advance_c<Iter, 2>,
mpl::eval_if<
apply_offset_filter<Iter, Pred, 3>,
result_of::advance_c<Iter, 3>,
unroll_again<
Iter,
Pred,
n,
4> > > > >::type type;
};
template<typename Iter, typename Pred>
struct unrolled_find_if<Iter, Pred, 3>
{
typedef typename mpl::eval_if<
apply_filter<Iter, Pred>,
mpl::identity<Iter>,
mpl::eval_if<
apply_offset_filter<Iter, Pred, 1>,
result_of::advance_c<Iter, 1>,
mpl::eval_if<
apply_offset_filter<Iter, Pred, 2>,
result_of::advance_c<Iter, 2>,
result_of::advance_c<Iter, 3> > > >::type type;
};
template<typename Iter, typename Pred>
struct unrolled_find_if<Iter, Pred, 2>
{
typedef typename mpl::eval_if<
apply_filter<Iter, Pred>,
mpl::identity<Iter>,
mpl::eval_if<
apply_offset_filter<Iter, Pred, 1>,
result_of::advance_c<Iter, 1>,
result_of::advance_c<Iter, 2> > >::type type;
};
template<typename Iter, typename Pred>
struct unrolled_find_if<Iter, Pred, 1>
{
typedef typename mpl::eval_if<
apply_filter<Iter, Pred>,
mpl::identity<Iter>,
result_of::advance_c<Iter, 1> >::type type;
};
template<typename Iter, typename Pred, int n, int unrolling>
struct unroll_again
{
typedef typename unrolled_find_if<
typename result_of::advance_c<Iter, unrolling>::type,
Pred,
n-unrolling>::type type;
};
template<typename Iter, typename Pred>
struct unrolled_find_if<Iter, Pred, 0>
{
typedef Iter type;
};
template<typename First, typename Last, typename Pred>
struct choose_find_if<First, Last, Pred, true>
{
typedef typename result_of::distance<First, Last>::type N;
typedef typename unrolled_find_if<First, Pred, N::value>::type type;
};
template <typename First, typename Last, typename Pred>
struct static_find_if
{
typedef typename
choose_find_if<
First
, Last
, typename mpl::lambda<Pred>::type
, is_base_of<random_access_traversal_tag, typename traits::category_of<First>::type>::value
>::type
type;
template <typename Iterator>
static type
recursive_call(Iterator const& iter, mpl::true_)
{
return iter;
}
template <typename Iterator>
static type
recursive_call(Iterator const& iter, mpl::false_)
{
return recursive_call(fusion::next(iter));
}
template <typename Iterator>
static type
recursive_call(Iterator const& iter)
{
typedef result_of::equal_to<Iterator, type> found;
return recursive_call(iter, found());
}
template <typename Iterator, typename Tag>
static type
choose_call(Iterator const& iter, Tag)
{
return recursive_call(iter);
}
template <typename Iterator>
static type
choose_call(Iterator const& iter, random_access_traversal_tag)
{
typedef typename result_of::distance<Iterator, type>::type N;
return fusion::advance<N>(iter);
}
template <typename Iterator>
static type
call(Iterator const& iter)
{
return choose_call(iter, typename traits::category_of<Iterator>::type());
}
};
template <typename First, typename Last, typename Pred>
struct static_seq_find_if : static_find_if<First, Last, Pred>
{
typedef typename static_find_if<First, Last, Pred>::type type;
template <typename Sequence>
static type
call(Sequence const& seq)
{
return static_find_if<First, Last, Pred>::call(fusion::begin(seq));
}
template <typename Sequence>
static type
call(Sequence& seq)
{
return static_find_if<First, Last, Pred>::call(fusion::begin(seq));
}
};
}}}
#endif

View File

@ -1,222 +0,0 @@
/*=============================================================================
Copyright (c) 2006 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(FIND_IF_S_05152006_1027)
#define FIND_IF_S_05152006_1027
#include <boost/mpl/not.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/fusion/algorithm/query/find_if.hpp>
#include <boost/fusion/sequence/container/list/cons.hpp>
#include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
#include <boost/fusion/sequence/view/ext_/segmented_iterator.hpp>
#include <boost/fusion/sequence/view/ext_/segmented_iterator_range.hpp>
#include <boost/fusion/support/ext_/is_segmented.hpp>
// fwd declarations
namespace boost { namespace fusion
{
namespace detail
{
template<typename Sequence, typename Pred, bool IsSegmented = traits::is_segmented<Sequence>::value>
struct static_find_if_s_recurse;
}
namespace result_of
{
template <typename Sequence, typename Pred>
struct find_if_s;
}
}}
namespace boost { namespace fusion { namespace detail
{
template<typename Sequence, typename Where, bool IsSegmented = traits::is_segmented<Sequence>::value>
struct is_found
: mpl::not_<result_of::equal_to<Where, typename result_of::end<Sequence>::type> >
{};
template<typename Sequence, typename Cons>
struct is_found<Sequence, Cons, true>
: mpl::not_<is_same<nil, Cons> >
{};
template<
typename SegmentedRange
, typename Where
, typename Sequence = typename remove_reference<
typename result_of::deref<
typename SegmentedRange::iterator_type
>::type
>::type
, bool IsSegmented = traits::is_segmented<Sequence>::value
>
struct as_segmented_cons
{
typedef cons<
SegmentedRange
, cons<segmented_range<Sequence, Where, false> >
> type;
static type call(SegmentedRange const &range, Where const &where)
{
return fusion::make_cons(
range
, fusion::make_cons(
segmented_range<Sequence, Where, false>(*fusion::begin(range), where)
)
);
}
};
template<
typename SegmentedRange
, typename Where
, typename Sequence
>
struct as_segmented_cons<SegmentedRange, Where, Sequence, true>
{
typedef cons<SegmentedRange, Where> type;
static type call(SegmentedRange const &range, Where const &where)
{
return fusion::make_cons(range, where);
}
};
template<
typename SegmentedRange
, typename Pred
, bool IsEmpty = is_empty<SegmentedRange>::value
>
struct static_find_if_s_seg
{
typedef typename SegmentedRange::iterator_type first;
typedef typename result_of::deref<first>::type segment_ref;
typedef typename remove_reference<segment_ref>::type segment;
typedef static_find_if_s_recurse<segment, Pred> where;
typedef range_next<SegmentedRange> next;
typedef is_found<segment, typename where::type> is_found;
typedef as_segmented_cons<SegmentedRange, typename where::type> found;
typedef static_find_if_s_seg<typename next::type, Pred> not_found;
typedef typename mpl::eval_if<is_found, found, not_found>::type type;
static type call(SegmentedRange const &range)
{
return call_(range, is_found());
}
private:
static type call_(SegmentedRange const &range, mpl::true_)
{
return found::call(range, where::call(*range.where));
}
static type call_(SegmentedRange const &range, mpl::false_)
{
return not_found::call(next::call(range));
}
};
template<
typename SegmentedRange
, typename Pred
>
struct static_find_if_s_seg<SegmentedRange, Pred, true>
{
typedef nil type;
static type call(SegmentedRange const &)
{
return nil();
}
};
template<typename Sequence, typename Pred>
struct static_find_if_s_recurse<Sequence, Pred, true>
{
typedef typename as_segmented_range<Sequence>::type range;
typedef static_find_if_s_seg<range, Pred> find_if;
typedef typename find_if::type type;
static type call(Sequence &seq)
{
return find_if::call(range(fusion::segments(seq)));
}
};
template<typename Sequence, typename Pred>
struct static_find_if_s_recurse<Sequence, Pred, false>
{
typedef typename result_of::find_if<Sequence, Pred>::type type;
static type call(Sequence &seq)
{
return fusion::find_if<Pred>(seq);
}
};
template<typename Sequence, typename Pred, bool IsSegmented = traits::is_segmented<Sequence>::value>
struct static_find_if_s
: static_find_if_s_recurse<Sequence, Pred, IsSegmented>
{};
template<typename Sequence, typename Pred>
struct static_find_if_s<Sequence, Pred, true>
{
typedef typename as_segmented_range<Sequence>::type range;
typedef static_find_if_s_recurse<Sequence, Pred> find_if;
typedef typename find_if::type found;
typedef segmented_iterator<typename reverse_cons<found>::type> type;
static type call(Sequence &seq)
{
return type(reverse_cons<found>::call(find_if::call(seq)));
}
};
}}}
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence, typename Pred>
struct find_if_s
{
typedef typename
detail::static_find_if_s<
Sequence
, Pred
>::type
type;
};
}
template <typename Pred, typename Sequence>
typename lazy_disable_if<
is_const<Sequence>
, result_of::find_if_s<Sequence, Pred>
>::type
find_if_s(Sequence& seq)
{
return detail::static_find_if_s<Sequence, Pred>::call(seq);
}
template <typename Pred, typename Sequence>
typename result_of::find_if_s<Sequence const, Pred>::type
find_if_s(Sequence const& seq)
{
return detail::static_find_if_s<Sequence const, Pred>::call(seq);
}
}}
#endif

View File

@ -1,75 +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)
==============================================================================*/
#if !defined(FUSION_FIND_05052005_1107)
#define FUSION_FIND_05052005_1107
#include <boost/fusion/algorithm/query/detail/find_if.hpp>
#include <boost/fusion/algorithm/query/detail/assoc_find.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost { namespace fusion
{
struct associative_sequence_tag;
namespace result_of
{
template <
typename Sequence
, typename T
, bool is_associative_sequence = traits::is_associative<Sequence>::value >
struct find;
template <typename Sequence, typename T>
struct find<Sequence, T, false>
{
typedef
detail::static_seq_find_if<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type
, is_same<mpl::_, T>
>
filter;
typedef typename filter::type type;
};
template <typename Sequence, typename T>
struct find<Sequence, T, true>
{
typedef detail::assoc_find<Sequence, T> filter;
typedef typename filter::type type;
};
}
template <typename T, typename Sequence>
inline typename
lazy_disable_if<
is_const<Sequence>
, result_of::find<Sequence, T>
>::type const
find(Sequence& seq)
{
typedef typename result_of::find<Sequence, T>::filter filter;
return filter::call(seq);
}
template <typename T, typename Sequence>
inline typename result_of::find<Sequence const, T>::type const
find(Sequence const& seq)
{
typedef typename result_of::find<Sequence const, T>::filter filter;
return filter::call(seq);
}
}}
#endif

View File

@ -1,69 +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)
==============================================================================*/
#if !defined(FUSION_FIND_IF_05052005_1108)
#define FUSION_FIND_IF_05052005_1108
#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/utility/enable_if.hpp>
#include <boost/type_traits/is_const.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence, typename Pred>
struct find_if
{
typedef typename
detail::static_find_if<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type
, Pred
>::type
type;
};
}
template <typename Pred, typename Sequence>
inline typename
lazy_disable_if<
is_const<Sequence>
, result_of::find_if<Sequence, Pred>
>::type
find_if(Sequence& seq)
{
typedef
detail::static_find_if<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type
, Pred
>
filter;
return filter::call(fusion::begin(seq));
}
template <typename Pred, typename Sequence>
inline typename result_of::find_if<Sequence const, Pred>::type const
find_if(Sequence const& seq)
{
typedef
detail::static_find_if<
typename result_of::begin<Sequence const>::type
, typename result_of::end<Sequence const>::type
, Pred
>
filter;
return filter::call(fusion::begin(seq));
}
}}
#endif

View File

@ -1,33 +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)
==============================================================================*/
#if !defined(BOOST_FUSION_NONE_07062005_1128)
#define BOOST_FUSION_NONE_07062005_1128
#include <boost/fusion/algorithm/query/any.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence, typename F>
struct none
{
typedef bool type;
};
}
template <typename Sequence, typename F>
inline bool
none(Sequence const& seq, F f)
{
return !fusion::any(seq, f);
}
}}
#endif