baking segmented Fusion

[SVN r73854]
This commit is contained in:
Eric Niebler
2011-08-17 18:53:56 +00:00
parent 2baebc560a
commit 528ad04fdb
86 changed files with 1403 additions and 1041 deletions

View File

@ -8,6 +8,7 @@
#if !defined(FUSION_CONS_07172005_0843)
#define FUSION_CONS_07172005_0843
#include <boost/fusion/container/list/cons_fwd.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
@ -55,7 +56,7 @@ namespace boost { namespace fusion
}
};
template <typename Car, typename Cdr = nil>
template <typename Car, typename Cdr /*= nil*/>
struct cons : sequence_base<cons<Car, Cdr> >
{
typedef mpl::int_<Cdr::size::value+1> size;

View File

@ -0,0 +1,20 @@
/*=============================================================================
Copyright (c) 2005 Joel de Guzman
Copyright (c) 2005 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_CONS_FWD_HPP_INCLUDED)
#define BOOST_FUSION_CONS_FWD_HPP_INCLUDED
namespace boost { namespace fusion
{
struct nil;
template <typename Car, typename Cdr = nil>
struct cons;
}}
#endif

View File

@ -7,8 +7,7 @@
#if !defined(BOOST_FUSION_REVERSE_CONS_HPP_INCLUDED)
#define BOOST_FUSION_REVERSE_CONS_HPP_INCLUDED
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/container/generation/make_cons.hpp>
#include <boost/fusion/container/list/cons_fwd.hpp>
namespace boost { namespace fusion { namespace detail
{
@ -24,7 +23,8 @@ namespace boost { namespace fusion { namespace detail
static type call(cons<Car, Cdr> const &cons, State const &state = State())
{
return impl::call(cons.cdr, fusion::make_cons(cons.car, state));
typedef fusion::cons<Car, State> cdr_type;
return impl::call(cons.cdr, cdr_type(cons.car, state));
}
};

View File

@ -0,0 +1,12 @@
/*=============================================================================
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_INCLUDE_IS_SEGMENTED)
#define BOOST_FUSION_INCLUDE_IS_SEGMENTED
#include <boost/fusion/support/is_segmented.hpp>
#endif

View File

@ -0,0 +1,12 @@
/*=============================================================================
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_INCLUDE_SEGMENTED_FOLD_UNTIL)
#define BOOST_FUSION_INCLUDE_SEGMENTED_FOLD_UNTIL
#include <boost/fusion/support/segmented_fold_until.hpp>
#endif

View File

@ -0,0 +1,12 @@
/*=============================================================================
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_INCLUDE_SEGMENTED_ITERATOR)
#define BOOST_FUSION_INCLUDE_SEGMENTED_ITERATOR
#include <boost/fusion/iterator/segmented_iterator.hpp>
#endif

View File

@ -0,0 +1,12 @@
/*=============================================================================
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_INCLUDE_SEGMENTS)
#define BOOST_FUSION_INCLUDE_SEGMENTS
#include <boost/fusion/sequence/intrinsic/segments.hpp>
#endif

View File

@ -0,0 +1,71 @@
/*=============================================================================
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_SEGMENTED_SEQUENCE_HPP_INCLUDED)
#define BOOST_FUSION_SEGMENTED_SEQUENCE_HPP_INCLUDED
#include <boost/mpl/bool.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/fusion/support/tag_of.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
namespace boost { namespace fusion { namespace detail
{
struct segment_sequence_tag {};
// Here, Sequence is a sequence of ranges (which may or may not be
// segmented).
template<typename Sequence>
struct segment_sequence
: sequence_base<segment_sequence<Sequence> >
{
typedef fusion_sequence_tag tag;
typedef segment_sequence_tag fusion_tag;
typedef typename Sequence::is_view is_view;
typedef typename Sequence::category category;
typedef Sequence sequence_type;
sequence_type sequence;
explicit segment_sequence(Sequence const & seq)
: sequence(seq)
{}
};
}
namespace extension
{
template<typename Tag>
struct is_segmented_impl;
template<>
struct is_segmented_impl<detail::segment_sequence_tag>
{
template<typename Sequence>
struct apply
: mpl::true_
{};
};
template<typename Tag>
struct segments_impl;
template<>
struct segments_impl<detail::segment_sequence_tag>
{
template<typename Sequence>
struct apply
{
typedef typename Sequence::sequence_type type;
static type call(Sequence & seq)
{
return seq.sequence;
}
};
};
}}}
#endif

View File

@ -0,0 +1,51 @@
/*=============================================================================
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_SEGMENTED_ITERATOR_EQUAL_TO_HPP_INCLUDED)
#define BOOST_FUSION_SEGMENTED_ITERATOR_EQUAL_TO_HPP_INCLUDED
#include <boost/mpl/and.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
namespace boost { namespace fusion
{
struct nil;
namespace detail
{
template <typename Stack1, typename Stack2>
struct segmented_equal_to
: mpl::and_<
result_of::equal_to<
typename Stack1::car_type::begin_type,
typename Stack2::car_type::begin_type
>,
segmented_equal_to<
typename Stack1::cdr_type,
typename Stack2::cdr_type
>
>
{};
template <typename Stack1>
struct segmented_equal_to<Stack1, fusion::nil>
: mpl::false_
{};
template <typename Stack2>
struct segmented_equal_to<fusion::nil, Stack2>
: mpl::false_
{};
template <>
struct segmented_equal_to<fusion::nil, fusion::nil>
: mpl::true_
{};
}
}}
#endif

View File

@ -7,24 +7,22 @@
#if !defined(BOOST_FUSION_SEGMENTED_ITERATOR_SEGMENTED_ITERATOR_HPP_INCLUDED)
#define BOOST_FUSION_SEGMENTED_ITERATOR_SEGMENTED_ITERATOR_HPP_INCLUDED
#include <boost/mpl/equal.hpp>
#include <boost/mpl/transform.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/fusion/mpl/begin.hpp>
#include <boost/fusion/mpl/end.hpp>
#include <boost/fusion/mpl/clear.hpp>
#include <boost/fusion/mpl/push_front.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/iterator/iterator_facade.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/iterator/segmented_iterator/detail/next_impl.hpp>
#include <boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp>
#include <boost/fusion/sequence/intrinsic/detail/segmented_end.hpp>
#include <boost/fusion/container/vector/convert.hpp>
#include <boost/fusion/iterator/detail/segmented_equal_to.hpp>
#include <boost/fusion/container/list/detail/reverse_cons.hpp>
namespace boost { namespace fusion
{
struct nil;
namespace detail
{
template <typename Stack>
struct segmented_next_impl;
}
// A segmented iterator wraps a "context", which is a cons list
// of ranges, the frontmost is range over values and the rest
// are ranges over internal segments.
@ -59,16 +57,9 @@ namespace boost { namespace fusion
// the bottom-most.
template<typename It1, typename It2>
struct equal_to
: mpl::equal<
typename mpl::reverse_transform<
typename result_of::as_vector<typename It1::context_type>::type,
result_of::begin<mpl::_1>
>::type,
typename mpl::reverse_transform<
typename result_of::as_vector<typename It2::context_type>::type,
result_of::begin<mpl::_1>
>::type,
result_of::equal_to<mpl::_1, mpl::_2>
: detail::segmented_equal_to<
typename detail::reverse_cons<typename It1::context_type>::type,
typename detail::reverse_cons<typename It2::context_type>::type
>
{};

View File

@ -10,27 +10,29 @@
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/container/list/cons_fwd.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/segmented_iterator/detail/begin_impl.hpp>
namespace boost { namespace fusion
{
template<typename First, typename Second>
template <typename First, typename Second>
struct iterator_range;
template<typename Context>
template <typename Context>
struct segmented_iterator;
namespace detail
{
template <typename Range, typename Stack>
struct segmented_begin_impl;
//bool is_invalid(stack)
//{
// return empty(car(stack));
//}
template<typename Stack>
template <typename Stack>
struct is_invalid
: result_of::equal_to<
typename Stack::car_type::begin_type,
@ -46,7 +48,7 @@ namespace boost { namespace fusion
// return cons(iterator_range(next(begin(car(stack))), end(car(stack))), cdr(stack));
//}
template<typename Stack>
template <typename Stack>
struct pop_front_car
{
typedef
@ -70,7 +72,7 @@ namespace boost { namespace fusion
}
};
template<
template <
typename Stack,
typename Next = typename pop_front_car<Stack>::type,
bool IsInvalid = is_invalid<Next>::value,
@ -86,7 +88,7 @@ namespace boost { namespace fusion
// return segmented_next_impl_recurse(stack.cdr);
//}
template<
template <
typename Stack,
int StackSize = Stack::size::value>
struct segmented_next_impl_recurse3
@ -100,7 +102,7 @@ namespace boost { namespace fusion
}
};
template<typename Stack>
template <typename Stack>
struct segmented_next_impl_recurse3<Stack, 1>
{
typedef typename Stack::car_type::end_type end_type;
@ -122,7 +124,7 @@ namespace boost { namespace fusion
// return res;
//}
template<
template <
typename Stack,
typename Range =
typename remove_reference<
@ -147,7 +149,7 @@ namespace boost { namespace fusion
}
};
template<typename Stack, typename Range, typename Result>
template <typename Stack, typename Range, typename Result>
struct segmented_next_impl_recurse2<Stack, Range, Result, false>
{
typedef Result type;
@ -170,7 +172,7 @@ namespace boost { namespace fusion
// return segmented_next_impl_recurse2(next)
//}
template<typename Stack, typename Next, bool IsInvalid, int StackSize>
template <typename Stack, typename Next, bool IsInvalid, int StackSize>
struct segmented_next_impl_recurse
{
typedef
@ -183,7 +185,7 @@ namespace boost { namespace fusion
}
};
template<typename Stack, typename Next>
template <typename Stack, typename Next>
struct segmented_next_impl_recurse<Stack, Next, true, 1>
{
typedef Next type;
@ -194,7 +196,7 @@ namespace boost { namespace fusion
}
};
template<typename Stack, typename Next, int StackSize>
template <typename Stack, typename Next, int StackSize>
struct segmented_next_impl_recurse<Stack, Next, false, StackSize>
{
typedef segmented_next_impl_recurse2<Next> impl;
@ -216,11 +218,11 @@ namespace boost { namespace fusion
// return next;
//}
template<
template <
typename Stack,
typename Next = typename pop_front_car<Stack>::type,
bool IsInvalid = is_invalid<Next>::value>
struct segmented_next_impl
struct segmented_next_impl_aux
{
typedef segmented_next_impl_recurse<typename Stack::cdr_type> impl;
typedef typename impl::type type;
@ -231,8 +233,8 @@ namespace boost { namespace fusion
}
};
template<typename Stack, typename Next>
struct segmented_next_impl<Stack, Next, false>
template <typename Stack, typename Next>
struct segmented_next_impl_aux<Stack, Next, false>
{
typedef Next type;
@ -241,6 +243,11 @@ namespace boost { namespace fusion
return pop_front_car<Stack>::call(stack);
}
};
template <typename Stack>
struct segmented_next_impl
: segmented_next_impl_aux<Stack>
{};
}
}}

View File

@ -7,6 +7,9 @@
#if !defined(BOOST_FUSION_SEGMENTED_ITERATOR_HPP_INCLUDED)
#define BOOST_FUSION_SEGMENTED_ITERATOR_HPP_INCLUDED
#include <boost/fusion/iterator/segmented_iterator/segmented_iterator.hpp>
#include <boost/fusion/iterator/detail/segmented_iterator.hpp>
#include <boost/fusion/iterator/detail/segmented_next_impl.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/container/list/cons.hpp>
#endif

View File

@ -1,112 +0,0 @@
/*=============================================================================
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_SEGMENTED_SEQUENCE_HPP_INCLUDED)
#define BOOST_FUSION_SEGMENTED_SEQUENCE_HPP_INCLUDED
#include <boost/mpl/bool.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/fusion/support/tag_of.hpp>
#include <boost/fusion/sequence/intrinsic/segments.hpp>
#include <boost/fusion/sequence/intrinsic/detail/segmented_size.hpp>
namespace boost { namespace fusion
{
namespace detail
{
struct segment_sequence_tag {};
// Here, Sequence is a sequence of ranges (which may or may not be
// segmented).
template<typename Sequence>
struct segment_sequence
: sequence_base<segment_sequence<Sequence> >
{
typedef fusion_sequence_tag tag;
typedef segment_sequence_tag fusion_tag;
typedef typename Sequence::is_view is_view;
typedef typename Sequence::category category;
typedef Sequence sequence_type;
sequence_type sequence;
explicit segment_sequence(Sequence const & seq)
: sequence(seq)
{}
};
}
namespace extension
{
template<typename Tag>
struct is_segmented_impl;
template<>
struct is_segmented_impl<detail::segment_sequence_tag>
{
template<typename Sequence>
struct apply
: mpl::true_
{};
};
template<typename Tag>
struct segments_impl;
template<>
struct segments_impl<detail::segment_sequence_tag>
{
template<typename Sequence>
struct apply
{
typedef typename Sequence::sequence_type type;
static type call(Sequence & seq)
{
return seq.sequence;
}
};
};
template<typename Tag>
struct begin_impl;
template<>
struct begin_impl<detail::segment_sequence_tag>
{
template<typename Sequence>
struct apply
: segmented_begin<Sequence>
{};
};
template<typename Tag>
struct end_impl;
template<>
struct end_impl<detail::segment_sequence_tag>
{
template<typename Sequence>
struct apply
: segmented_end<Sequence>
{};
};
template<typename Tag>
struct size_impl;
template<>
struct size_impl<detail::segment_sequence_tag>
{
template<typename Sequence>
struct apply
: segmented_size<Sequence>::type
{};
};
}
}}
#endif

View File

@ -9,6 +9,7 @@
#include <boost/mpl/int.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/support/tag_of.hpp>
#include <boost/fusion/support/detail/access.hpp>

View File

@ -9,6 +9,7 @@
#define BOOST_FUSION_AT_KEY_20060304_1755
#include <boost/type_traits/is_const.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/algorithm/query/find.hpp>
#include <boost/fusion/iterator/deref_data.hpp>
#include <boost/fusion/support/tag_of.hpp>

View File

@ -7,6 +7,7 @@
#if !defined(FUSION_BACK_09162005_0350)
#define FUSION_BACK_09162005_0350
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/iterator/prior.hpp>
#include <boost/fusion/iterator/deref.hpp>

View File

@ -7,9 +7,14 @@
#if !defined(FUSION_BEGIN_04052005_1132)
#define FUSION_BEGIN_04052005_1132
#include <boost/blank.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/support/tag_of.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp>
namespace boost { namespace fusion
{
@ -26,7 +31,13 @@ namespace boost { namespace fusion
struct begin_impl
{
template <typename Sequence>
struct apply;
struct apply
: mpl::if_<
traits::is_segmented<Sequence>
, detail::segmented_begin<Sequence>
, blank
>::type
{};
};
template <>

View File

@ -7,13 +7,11 @@
#if !defined(BOOST_FUSION_SEGMENTED_BEGIN_HPP_INCLUDED)
#define BOOST_FUSION_SEGMENTED_BEGIN_HPP_INCLUDED
#include <boost/fusion/iterator/segmented_iterator/detail/begin_impl.hpp>
#include <boost/fusion/sequence/intrinsic/detail/segmented_begin_impl.hpp>
#include <boost/fusion/iterator/segmented_iterator.hpp>
namespace boost { namespace fusion
namespace boost { namespace fusion { namespace detail
{
template<typename Context>
struct segmented_iterator;
//auto segmented_begin( rng )
//{
// return make_segmented_iterator( segmented_begin_impl( rng, nil ) );
@ -24,17 +22,17 @@ namespace boost { namespace fusion
{
typedef
segmented_iterator<
typename detail::segmented_begin_impl<Range, fusion::nil>::type
typename segmented_begin_impl<Range, fusion::nil>::type
>
type;
static type call(Range & rng)
{
return type(
detail::segmented_begin_impl<Range, fusion::nil>::call(rng, fusion::nil()));
segmented_begin_impl<Range, fusion::nil>::call(rng, fusion::nil()));
}
};
}}
}}}
#endif

View File

@ -8,23 +8,26 @@
#define BOOST_FUSION_SEGMENTED_BEGIN_IMPL_HPP_INCLUDED
#include <boost/type_traits/remove_const.hpp>
#include <boost/fusion/view/iterator_range.hpp>
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/container/generation/make_cons.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/container/list/cons_fwd.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/iterator/segmented_iterator/detail/end_impl.hpp>
#include <boost/fusion/support/segmented_fold_until.hpp>
#include <boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp>
#include <boost/fusion/support/detail/segmented_fold_until_impl.hpp>
namespace boost { namespace fusion
{
template <typename First, typename Last>
struct iterator_range;
}}
namespace boost { namespace fusion { namespace detail
{
struct segmented_begin_fun
{
template<typename Sig>
template <typename Sig>
struct result;
template<typename This, typename Range, typename State, typename Context>
template <typename This, typename Range, typename State, typename Context>
struct result<This(Range&, State&, Context&)>
{
typedef
@ -42,7 +45,7 @@ namespace boost { namespace fusion { namespace detail
type;
};
template<typename Range, typename State, typename Context>
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
{
@ -53,12 +56,12 @@ namespace boost { namespace fusion { namespace detail
>
range_type;
return fusion::make_cons(range_type(fusion::begin(rng), fusion::end(rng)), context);
return cons<range_type, Context>(range_type(fusion::begin(rng), fusion::end(rng)), context);
}
};
template<typename Range, typename Stack, bool IsSegmented = traits::is_segmented<Range>::type::value>
struct segmented_begin_impl
template <typename Range, typename Stack, bool IsSegmented = traits::is_segmented<Range>::type::value>
struct segmented_begin_impl_aux
{
typedef
segmented_end_impl<Range, Stack>
@ -81,8 +84,8 @@ namespace boost { namespace fusion { namespace detail
}
};
template<typename Range, typename Stack>
struct segmented_begin_impl<Range, Stack, false>
template <typename Range, typename Stack>
struct segmented_begin_impl_aux<Range, Stack, false>
{
typedef typename result_of::begin<Range>::type begin_type;
typedef typename result_of::end<Range>::type end_type;
@ -95,6 +98,11 @@ namespace boost { namespace fusion { namespace detail
}
};
template <typename Range, typename Stack>
struct segmented_begin_impl
: segmented_begin_impl_aux<Range, Stack>
{};
}}}
#endif

View File

@ -7,14 +7,12 @@
#if !defined(BOOST_FUSION_SEGMENTED_END_HPP_INCLUDED)
#define BOOST_FUSION_SEGMENTED_END_HPP_INCLUDED
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/iterator/segmented_iterator/detail/end_impl.hpp>
#include <boost/fusion/container/list/cons_fwd.hpp>
#include <boost/fusion/sequence/intrinsic/detail/segmented_end_impl.hpp>
#include <boost/fusion/iterator/segmented_iterator.hpp>
namespace boost { namespace fusion
namespace boost { namespace fusion { namespace detail
{
template<typename Context>
struct segmented_iterator;
//auto segmented_end( rng )
//{
// return make_segmented_iterator( segmented_end_impl( rng ) );
@ -25,17 +23,17 @@ namespace boost { namespace fusion
{
typedef
segmented_iterator<
typename detail::segmented_end_impl<Range, fusion::nil>::type
typename segmented_end_impl<Range, fusion::nil>::type
>
type;
static type call(Range & rng)
{
return type(
detail::segmented_end_impl<Range, fusion::nil>::call(rng, fusion::nil()));
segmented_end_impl<Range, fusion::nil>::call(rng, fusion::nil()));
}
};
}}
}}}
#endif

View File

@ -10,12 +10,16 @@
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/fusion/view/iterator_range.hpp>
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/segments.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/container/list/cons_fwd.hpp>
#include <boost/fusion/support/is_segmented.hpp>
namespace boost { namespace fusion
{
template <typename First, typename Last>
struct iterator_range;
}}
namespace boost { namespace fusion { namespace detail
{
//auto segmented_end_impl( rng, stack )

View File

@ -13,23 +13,18 @@
#include <boost/mpl/plus.hpp>
#include <boost/mpl/size_t.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/mpl/begin.hpp>
#include <boost/fusion/mpl/end.hpp>
#include <boost/fusion/mpl/clear.hpp>
#include <boost/fusion/mpl/push_front.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/sequence/intrinsic/segments.hpp>
#include <boost/fusion/support/is_segmented.hpp>
namespace boost { namespace fusion
namespace boost { namespace fusion { namespace detail
{
///////////////////////////////////////////////////////////////////////////
// calculates the size of any segmented data structure.
template<typename Sequence>
struct segmented_size;
namespace detail
{
///////////////////////////////////////////////////////////////////////////
template<typename Sequence, bool IsSegmented = traits::is_segmented<Sequence>::value>
struct segmented_size_impl
@ -48,13 +43,12 @@ namespace boost { namespace fusion
struct segmented_size_impl<Sequence, false>
: result_of::size<Sequence>::type
{};
}
template<typename Sequence>
struct segmented_size
: detail::segmented_size_impl<Sequence>
: segmented_size_impl<Sequence>
{};
}}
}}}
#endif

View File

@ -7,6 +7,7 @@
#if !defined(FUSION_EMPTY_09162005_0335)
#define FUSION_EMPTY_09162005_0335
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/fusion/support/tag_of.hpp>

View File

@ -7,9 +7,14 @@
#if !defined(FUSION_END_04052005_1141)
#define FUSION_END_04052005_1141
#include <boost/blank.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/support/tag_of.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/sequence/intrinsic/detail/segmented_end.hpp>
namespace boost { namespace fusion
{
@ -26,7 +31,13 @@ namespace boost { namespace fusion
struct end_impl
{
template <typename Sequence>
struct apply;
struct apply
: mpl::if_<
traits::is_segmented<Sequence>
, detail::segmented_end<Sequence>
, blank
>::type
{};
};
template <>

View File

@ -7,6 +7,7 @@
#if !defined(FUSION_FRONT_09162005_0343)
#define FUSION_FRONT_09162005_0343
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/mpl/bool.hpp>

View File

@ -7,6 +7,7 @@
#if !defined(FUSION_HAS_KEY_09232005_1454)
#define FUSION_HAS_KEY_09232005_1454
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/support/tag_of.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/algorithm/query/find.hpp>

View File

@ -7,6 +7,9 @@
#if !defined(BOOST_FUSION_SEGMENTS_04052005_1141)
#define BOOST_FUSION_SEGMENTS_04052005_1141
#include <boost/type_traits/is_const.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/support/tag_of.hpp>
namespace boost { namespace fusion
@ -50,15 +53,19 @@ namespace boost { namespace fusion
}
template <typename Sequence>
typename result_of::segments<Sequence>::type
segments(Sequence & seq)
inline typename
lazy_disable_if<
is_const<Sequence>
, result_of::segments<Sequence>
>::type
segments(Sequence& seq)
{
typedef typename traits::tag_of<Sequence>::type tag_type;
return extension::segments_impl<tag_type>::template apply<Sequence>::call(seq);
}
template <typename Sequence>
typename result_of::segments<Sequence const>::type
inline typename result_of::segments<Sequence const>::type
segments(Sequence const& seq)
{
typedef typename traits::tag_of<Sequence const>::type tag_type;

View File

@ -7,8 +7,13 @@
#if !defined(FUSION_SIZE_05052005_0214)
#define FUSION_SIZE_05052005_0214
#include <boost/utility/enable_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/int.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/support/tag_of.hpp>
#include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/sequence/intrinsic/detail/segmented_size.hpp>
namespace boost { namespace fusion
{
@ -24,8 +29,17 @@ namespace boost { namespace fusion
template <typename Tag>
struct size_impl
{
template<typename Sequence>
struct unsegmented_size : Sequence::size {};
template <typename Sequence>
struct apply : Sequence::size {};
struct apply
: mpl::if_<
traits::is_segmented<Sequence>
, detail::segmented_size<Sequence>
, unsegmented_size<Sequence>
>::type
{};
};
template <>

View File

@ -8,6 +8,7 @@
#define FUSION_VALUE_AT_05052005_0229
#include <boost/mpl/int.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/support/tag_of.hpp>
namespace boost { namespace fusion

View File

@ -9,6 +9,7 @@
#define FUSION_VALUE_AT_KEY_05052005_0229
#include <boost/mpl/int.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/iterator/value_of_data.hpp>
#include <boost/fusion/algorithm/query/find.hpp>
#include <boost/fusion/support/tag_of.hpp>

View File

@ -0,0 +1,203 @@
/*=============================================================================
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(BOOST_FUSION_SEQUENCE_INTRINSIC_FWD_HPP_INCLUDED)
#define BOOST_FUSION_SEQUENCE_INTRINSIC_FWD_HPP_INCLUDED
#include <boost/type_traits/is_const.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/fusion/support/is_sequence.hpp>
namespace boost { namespace fusion
{
namespace extension
{
template <typename Tag>
struct at_impl;
template <typename Tag>
struct begin_impl;
template <typename Tag>
struct empty_impl;
template <typename Tag>
struct end_impl;
template <typename Tag>
struct has_key_impl;
template <typename Tag>
struct segments_impl;
template <typename Tag>
struct size_impl;
template <typename Tag>
struct value_at_impl;
template <typename Tag>
struct at_key_impl;
template <typename Tag>
struct value_at_key_impl;
}
namespace result_of
{
template <typename Sequence, typename N>
struct at;
template <typename Sequence, int N>
struct at_c;
template <typename Sequence>
struct back;
template <typename Sequence>
struct begin;
template <typename Sequence>
struct empty;
template <typename Sequence>
struct end;
template <typename Sequence>
struct front;
template <typename Sequence, typename Key>
struct has_key;
template <typename Sequence>
struct segments;
template <typename Sequence>
struct size;
template <typename Sequence, typename N>
struct value_at;
template <typename Sequence, int N>
struct value_at_c;
template <typename Sequence, typename Key>
struct at_key;
template <typename Sequence, typename N>
struct value_at_key;
}
template <typename N, typename Sequence>
typename
lazy_disable_if<
is_const<Sequence>
, result_of::at<Sequence, N>
>::type
at(Sequence& seq);
template <typename N, typename Sequence>
typename result_of::at<Sequence const, N>::type
at(Sequence const& seq);
template <int N, typename Sequence>
typename
lazy_disable_if<
is_const<Sequence>
, result_of::at_c<Sequence, N>
>::type
at_c(Sequence& seq);
template <int N, typename Sequence>
typename result_of::at_c<Sequence const, N>::type
at_c(Sequence const& seq);
template <typename Sequence>
typename result_of::back<Sequence>::type
back(Sequence& seq);
template <typename Sequence>
typename result_of::back<Sequence const>::type
back(Sequence const& seq);
template <typename Sequence>
typename
lazy_enable_if<
traits::is_sequence<Sequence>
, result_of::begin<Sequence>
>::type const
begin(Sequence& seq);
template <typename Sequence>
typename
lazy_enable_if<
traits::is_sequence<Sequence>
, result_of::begin<Sequence const>
>::type const
begin(Sequence const& seq);
template <typename Sequence>
typename result_of::empty<Sequence>::type
empty(Sequence const&);
template <typename Sequence>
typename
lazy_enable_if<
traits::is_sequence<Sequence>
, result_of::end<Sequence>
>::type const
end(Sequence& seq);
template <typename Sequence>
typename
lazy_enable_if<
traits::is_sequence<Sequence>
, result_of::end<Sequence const>
>::type const
end(Sequence const& seq);
template <typename Sequence>
typename result_of::front<Sequence>::type
front(Sequence& seq);
template <typename Sequence>
typename result_of::front<Sequence const>::type
front(Sequence const& seq);
template <typename Key, typename Sequence>
typename result_of::has_key<Sequence, Key>::type
has_key(Sequence const& seq);
template <typename Sequence>
typename
lazy_disable_if<
is_const<Sequence>
, result_of::segments<Sequence>
>::type
segments(Sequence& seq);
template <typename Sequence>
typename result_of::segments<Sequence const>::type
segments(Sequence const& seq);
template <typename Sequence>
typename result_of::size<Sequence>::type
size(Sequence const&);
template <typename Key, typename Sequence>
typename
lazy_disable_if<
is_const<Sequence>
, result_of::at_key<Sequence, Key>
>::type
at_key(Sequence& seq);
template <typename Key, typename Sequence>
typename result_of::at_key<Sequence const, Key>::type
at_key(Sequence const& seq);
}}
#endif

View File

@ -0,0 +1,401 @@
/*=============================================================================
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_SEGMENTED_FOLD_UNTIL_IMPL_HPP_INCLUDED)
#define BOOST_FUSION_SEGMENTED_FOLD_UNTIL_IMPL_HPP_INCLUDED
#include <boost/mpl/bool.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/fusion/support/void.hpp>
#include <boost/fusion/container/list/cons_fwd.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/sequence/intrinsic/segments.hpp>
// fun(rng, state, context)
// rng: a non-segmented range
// state: the state of the fold so far
// context: the path to the current range
//
// returns: (state', fcontinue)
namespace boost { namespace fusion
{
template <typename First, typename Last>
struct iterator_range;
template <typename Context>
struct segmented_iterator;
namespace result_of
{
template <typename Cur, typename Context>
struct make_segmented_iterator
{
typedef
iterator_range<
Cur,
typename result_of::end<
typename remove_reference<
typename add_const<
typename result_of::deref<
typename Context::car_type::begin_type
>::type
>::type
>::type
>::type
>
range_type;
typedef
segmented_iterator<cons<range_type, Context> >
type;
};
}
template <typename Cur, typename Context>
typename result_of::make_segmented_iterator<Cur, Context>::type
make_segmented_iterator(Cur const& cur, Context const& context)
{
typedef result_of::make_segmented_iterator<Cur, Context> impl_type;
typedef typename impl_type::type type;
typedef typename impl_type::range_type range_type;
return type(cons<range_type, Context>(range_type(cur, fusion::end(*context.car.first)), context));
}
typedef mpl::true_ continue_;
typedef mpl::false_ break_;
template <typename Value, typename Continue>
struct result
{
typedef Value value_type;
typedef Continue continue_type;
result(Value const& val)
: value(val)
{}
value_type value;
};
template <typename Continue>
struct result<void, Continue>
{
typedef void_ value_type;
typedef Continue continue_type;
result(void_ const&)
{}
value_type value;
};
template <typename Value>
result<Value, continue_> make_result_continue(Value const& val)
{
return result<Value, continue_>(val);
}
template <typename Value>
result<Value, break_> make_result_break(Value const& val)
{
return result<Value, break_>(val);
}
namespace detail
{
template <
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>
struct segmented_fold_until_iterate;
template <
typename Range,
typename State,
typename Context,
typename Fun,
bool IsSegmented = traits::is_segmented<Range>::type::value>
struct segmented_fold_until_impl;
template <typename Segments, typename State, typename Context, typename Fun>
struct segmented_fold_until_on_segments;
//auto push_context(cur, end, context)
//{
// return push_back(context, segment_sequence(iterator_range(cur, end)));
//}
template <typename Cur, typename End, typename Context>
struct push_context
{
typedef iterator_range<Cur, End> range_type;
typedef cons<range_type, Context> type;
static type call(Cur const& cur, End const& end, Context const& context)
{
return cons<range_type, Context>(range_type(cur, end), context);
}
};
//auto make_segmented_iterator(cur, end, context)
//{
// return segmented_iterator(push_context(cur, end, context));
//}
//
//auto segmented_fold_until_impl(rng, state, context, fun)
//{
// if (is_segmented(rng))
// {
// segmented_fold_until_on_segments(segments(rng), state, context, fun);
// }
// else
// {
// return fun(rng, state, context);
// }
//}
template <
typename Range,
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
>::type
>::type,
State,
Context,
Fun
>
impl;
typedef typename impl::type type;
static type call(Range& rng, State const& state, Context const& context, Fun const& fun)
{
return impl::call(fusion::segments(rng), state, context, fun);
}
};
template <
typename Range,
typename State,
typename Context,
typename Fun>
struct segmented_fold_until_impl<Range, 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&
)>::type
type;
static type call(Range& rng, State const& state, Context const& context, Fun const& fun)
{
return fun(rng, state.value, context);
}
};
//auto segmented_fold_until_on_segments(segs, state, context, fun)
//{
// auto cur = begin(segs), end = end(segs);
// for (; cur != end; ++cur)
// {
// if (empty(*cur))
// continue;
// auto context` = push_context(cur, end, context);
// state = segmented_fold_until_impl(*cur, state, context`, fun);
// if (!second(state))
// return state;
// }
//}
template <typename Begin, typename End, typename State, typename Context, typename Fun, bool IsEmpty>
struct segmented_fold_until_iterate_skip_empty
{
// begin != end and !empty(*begin)
typedef
push_context<Begin, End, Context>
push_context_impl;
typedef
typename push_context_impl::type
next_context_type;
typedef
segmented_fold_until_impl<
typename remove_reference<
typename add_const<
typename result_of::deref<Begin>::type
>::type
>::type,
State,
next_context_type,
Fun
>
fold_recurse_impl;
typedef
typename fold_recurse_impl::type
next_state_type;
typedef
segmented_fold_until_iterate<
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>
>::type
type;
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
{
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);
}
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);
}
};
template <typename Begin, typename End, typename State, typename Context, typename Fun>
struct segmented_fold_until_iterate_skip_empty<Begin, End, State, Context, Fun, true>
{
typedef
segmented_fold_until_iterate<
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)
{
return impl::call(fusion::next(beg), end, state, context, fun);
}
};
template <typename Begin, typename End, typename State, typename Context, typename Fun, bool IsDone>
struct segmented_fold_until_iterate
{
typedef
segmented_fold_until_iterate_skip_empty<Begin, 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)
{
return impl::call(beg, end, state, context, fun);
}
};
template <typename Begin, typename End, typename State, typename Context, typename Fun>
struct segmented_fold_until_iterate<Begin, End, State, Context, Fun, true>
{
typedef State type;
static type call(Begin const&, End const&, State const& state,
Context const&, Fun const&)
{
return state;
}
};
template <typename Segments, typename State, typename Context, typename Fun>
struct segmented_fold_until_on_segments
{
typedef
segmented_fold_until_iterate<
typename result_of::begin<Segments>::type,
typename result_of::end<Segments>::type,
State,
Context,
Fun
>
impl;
typedef typename impl::type type;
static type call(Segments& segs, State const& state, Context const& context, Fun const& fun)
{
return impl::call(fusion::begin(segs), fusion::end(segs), state, context, fun);
}
};
}
}}
#endif

View File

@ -7,397 +7,15 @@
#if !defined(BOOST_FUSION_SEGMENTED_FOLD_UNTIL_HPP_INCLUDED)
#define BOOST_FUSION_SEGMENTED_FOLD_UNTIL_HPP_INCLUDED
#include <boost/mpl/bool.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/fusion/support/void.hpp>
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/container/generation/make_cons.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>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/sequence/intrinsic/segments.hpp>
// fun(rng, state, context)
// rng: a non-segmented range
// state: the state of the fold so far
// context: the path to the current range
//
// returns: (state', fcontinue)
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/container/list/cons.hpp>
namespace boost { namespace fusion
{
template<typename Context>
struct segmented_iterator;
namespace result_of
{
template<typename Cur, typename Context>
struct make_segmented_iterator
{
typedef
iterator_range<
Cur,
typename result_of::end<
typename remove_reference<
typename add_const<
typename result_of::deref<
typename Context::car_type::begin_type
>::type
>::type
>::type
>::type
>
range_type;
typedef
segmented_iterator<cons<range_type, Context> >
type;
};
}
template<typename Cur, typename Context>
typename result_of::make_segmented_iterator<Cur, Context>::type
make_segmented_iterator(Cur const& cur, Context const& context)
{
typedef result_of::make_segmented_iterator<Cur, Context> impl_type;
typedef typename impl_type::type type;
typedef typename impl_type::range_type range_type;
return type(fusion::make_cons(range_type(cur, fusion::end(*context.car.first)), context));
}
typedef mpl::true_ continue_;
typedef mpl::false_ break_;
template<typename Value, typename Continue>
struct result
{
typedef Value value_type;
typedef Continue continue_type;
result(Value const& val)
: value(val)
{}
value_type value;
};
template<typename Continue>
struct result<void, Continue>
{
typedef void_ value_type;
typedef Continue continue_type;
result(void_ const&)
{}
value_type value;
};
template<typename Value>
result<Value, continue_> make_result_continue(Value const& val)
{
return result<Value, continue_>(val);
}
template<typename Value>
result<Value, break_> make_result_break(Value const& val)
{
return result<Value, break_>(val);
}
namespace detail
{
template<
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>
struct segmented_fold_until_iterate;
template<
typename Range,
typename State,
typename Context,
typename Fun,
bool IsSegmented = traits::is_segmented<Range>::type::value>
struct segmented_fold_until_impl;
template<typename Segments, typename State, typename Context, typename Fun>
struct segmented_fold_until_on_segments;
//auto push_context(cur, end, context)
//{
// return push_back(context, segment_sequence(iterator_range(cur, end)));
//}
template<typename Cur, typename End, typename Context>
struct push_context
{
typedef iterator_range<Cur, End> range_type;
typedef cons<range_type, Context> type;
static type call(Cur const& cur, End const& end, Context const& context)
{
return fusion::make_cons(range_type(cur, end), context);
}
};
//auto make_segmented_iterator(cur, end, context)
//{
// return segmented_iterator(push_context(cur, end, context));
//}
//
//auto segmented_fold_until_impl(rng, state, context, fun)
//{
// if (is_segmented(rng))
// {
// segmented_fold_until_on_segments(segments(rng), state, context, fun);
// }
// else
// {
// return fun(rng, state, context);
// }
//}
template<
typename Range,
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
>::type
>::type,
State,
Context,
Fun
>
impl;
typedef typename impl::type type;
static type call(Range& rng, State const& state, Context const& context, Fun const& fun)
{
return impl::call(fusion::segments(rng), state, context, fun);
}
};
template<
typename Range,
typename State,
typename Context,
typename Fun>
struct segmented_fold_until_impl<Range, 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&
)>::type
type;
static type call(Range& rng, State const& state, Context const& context, Fun const& fun)
{
return fun(rng, state.value, context);
}
};
//auto segmented_fold_until_on_segments(segs, state, context, fun)
//{
// auto cur = begin(segs), end = end(segs);
// for (; cur != end; ++cur)
// {
// if (empty(*cur))
// continue;
// auto context` = push_context(cur, end, context);
// state = segmented_fold_until_impl(*cur, state, context`, fun);
// if (!second(state))
// return state;
// }
//}
template<typename Begin,typename End,typename State,typename Context,typename Fun,bool IsEmpty>
struct segmented_fold_until_iterate_skip_empty
{
// begin != end and !empty(*begin)
typedef
push_context<Begin, End, Context>
push_context_impl;
typedef
typename push_context_impl::type
next_context_type;
typedef
segmented_fold_until_impl<
typename remove_reference<
typename add_const<
typename result_of::deref<Begin>::type
>::type
>::type,
State,
next_context_type,
Fun
>
fold_recurse_impl;
typedef
typename fold_recurse_impl::type
next_state_type;
typedef
segmented_fold_until_iterate<
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>
>::type
type;
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
{
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);
}
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);
}
};
template<typename Begin, typename End, typename State, typename Context, typename Fun>
struct segmented_fold_until_iterate_skip_empty<Begin, End, State, Context, Fun, true>
{
typedef
segmented_fold_until_iterate<
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)
{
return impl::call(fusion::next(beg), end, state, context, fun);
}
};
template<typename Begin, typename End, typename State, typename Context, typename Fun, bool IsDone>
struct segmented_fold_until_iterate
{
typedef
segmented_fold_until_iterate_skip_empty<Begin, 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)
{
return impl::call(beg, end, state, context, fun);
}
};
template<typename Begin, typename End, typename State, typename Context, typename Fun>
struct segmented_fold_until_iterate<Begin, End, State, Context, Fun, true>
{
typedef State type;
static type call(Begin const&, End const&, State const& state,
Context const&, Fun const&)
{
return state;
}
};
template<typename Segments, typename State, typename Context, typename Fun>
struct segmented_fold_until_on_segments
{
typedef
segmented_fold_until_iterate<
typename result_of::begin<Segments>::type,
typename result_of::end<Segments>::type,
State,
Context,
Fun
>
impl;
typedef typename impl::type type;
static type call(Segments& segs, State const& state, Context const& context, Fun const& fun)
{
return impl::call(fusion::begin(segs), fusion::end(segs), state, context, fun);
}
};
}
//auto segmented_fold_until(rng, state, fun)
//{
// return first(segmented_fold_until_impl(rng, state, nil, fun));
@ -405,7 +23,7 @@ namespace boost { namespace fusion
namespace result_of
{
template<typename Range, typename State, typename Fun>
template <typename Range, typename State, typename Fun>
struct segmented_fold_until
{
typedef
@ -423,7 +41,7 @@ namespace boost { namespace fusion
};
}
template<typename Range, typename State, typename Fun>
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)
{
@ -431,7 +49,7 @@ namespace boost { namespace fusion
return impl::call(rng, state, fusion::nil(), fun).value;
}
template<typename Range, typename State, typename Fun>
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)
{
@ -439,5 +57,4 @@ namespace boost { namespace fusion
return impl::call(rng, state, fusion::nil(), fun).value;
}
}}
#endif

View File

@ -0,0 +1,66 @@
/*=============================================================================
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_ITERATOR_RANGE_IS_SEGMENTED_HPP_INCLUDED)
#define BOOST_FUSION_ITERATOR_RANGE_IS_SEGMENTED_HPP_INCLUDED
#include <boost/mpl/assert.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct iterator_range_tag;
template <typename Context>
struct segmented_iterator;
namespace extension
{
template <typename Tag>
struct is_segmented_impl;
// An iterator_range of segmented_iterators is segmented
template <>
struct is_segmented_impl<iterator_range_tag>
{
private:
template <typename Iterator>
struct is_segmented_iterator
: mpl::false_
{};
template <typename Iterator>
struct is_segmented_iterator<Iterator &>
: is_segmented_iterator<Iterator>
{};
template <typename Iterator>
struct is_segmented_iterator<Iterator const>
: is_segmented_iterator<Iterator>
{};
template <typename Context>
struct is_segmented_iterator<segmented_iterator<Context> >
: mpl::true_
{};
public:
template <typename Sequence>
struct apply
: 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);
};
};
}
}}
#endif

View File

@ -16,14 +16,11 @@
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/sequence/intrinsic/segments.hpp>
#include <boost/fusion/sequence/intrinsic/detail/segmented_size.hpp>
#include <boost/fusion/algorithm/transformation/push_back.hpp>
#include <boost/fusion/algorithm/transformation/push_front.hpp>
#include <boost/fusion/view/iterator_range.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/segmented_iterator.hpp>
#include <boost/fusion/container/list/detail/reverse_cons.hpp>
#include <boost/fusion/iterator/segmented_iterator/detail/segment_sequence.hpp>
#include <boost/fusion/iterator/detail/segment_sequence.hpp>
// Invariants:
// - Each segmented iterator has a stack
@ -35,8 +32,8 @@
namespace boost { namespace fusion
{
template<typename Context>
struct segmented_iterator;
template <typename First, typename Last>
struct iterator_range;
}}
namespace boost { namespace fusion { namespace detail
@ -65,7 +62,7 @@ namespace boost { namespace fusion { namespace detail
// }
//}
template<typename Stack, std::size_t Size = Stack::size::value>
template <typename Stack, std::size_t Size = Stack::size::value>
struct make_segment_sequence_front
{
// assert(end(segments(front(car(stack_begin)))) == end(car(cdr(stack_begin))));
@ -138,7 +135,7 @@ namespace boost { namespace fusion { namespace detail
}
};
template<typename Stack>
template <typename Stack>
struct make_segment_sequence_front<Stack, 2>
{
// assert(end(front(car(stack_begin))) == end(car(cdr(stack_begin))));
@ -178,7 +175,7 @@ namespace boost { namespace fusion { namespace detail
}
};
template<typename Stack>
template <typename Stack>
struct make_segment_sequence_front<Stack, 1>
{
typedef nil type;
@ -209,7 +206,7 @@ namespace boost { namespace fusion { namespace detail
// }
//}
template<typename Stack, std::size_t Size = Stack::size::value>
template <typename Stack, std::size_t Size = Stack::size::value>
struct make_segment_sequence_back
{
// assert(end(segments(front(car(stack_begin)))) == end(car(cdr(stack_begin))));
@ -280,7 +277,7 @@ namespace boost { namespace fusion { namespace detail
}
};
template<typename Stack>
template <typename Stack>
struct make_segment_sequence_back<Stack, 2>
{
// assert(end(front(car(stack_end))) == end(car(cdr(stack_end))));
@ -320,7 +317,7 @@ namespace boost { namespace fusion { namespace detail
}
};
template<typename Stack>
template <typename Stack>
struct make_segment_sequence_back<Stack, 1>
{
typedef nil type;
@ -364,14 +361,14 @@ namespace boost { namespace fusion { namespace detail
// }
//}
template<
template <
typename StackBegin,
typename StackEnd,
int StackBeginSize = StackBegin::size::value,
int StackEndSize = StackEnd::size::value>
struct make_segmented_range_reduce;
template<
template <
typename StackBegin,
typename StackEnd,
bool SameSegment =
@ -421,7 +418,7 @@ namespace boost { namespace fusion { namespace detail
}
};
template<typename StackBegin, typename StackEnd>
template <typename StackBegin, typename StackEnd>
struct make_segmented_range_reduce2<StackBegin, StackEnd, true>
{
typedef
@ -441,12 +438,12 @@ namespace boost { namespace fusion { namespace detail
}
};
template<typename StackBegin, typename StackEnd, int StackBeginSize, int StackEndSize>
template <typename StackBegin, typename StackEnd, int StackBeginSize, int StackEndSize>
struct make_segmented_range_reduce
: make_segmented_range_reduce2<StackBegin, StackEnd>
{};
template<typename StackBegin, typename StackEnd>
template <typename StackBegin, typename StackEnd>
struct make_segmented_range_reduce<StackBegin, StackEnd, 1, 1>
{
typedef
@ -478,7 +475,7 @@ namespace boost { namespace fusion { namespace detail
// return make_segmented_range_reduce(reverse(begin.context), reverse(end.context));
//}
template<typename Begin, typename End>
template <typename Begin, typename End>
struct make_segmented_range
{
typedef reverse_cons<typename Begin::context_type> reverse_begin_cons;
@ -503,81 +500,4 @@ namespace boost { namespace fusion { namespace detail
}}}
namespace boost { namespace fusion { namespace extension
{
template<typename Tag>
struct is_segmented_impl;
// An iterator_range of segmented_iterators is segmented
template<>
struct is_segmented_impl<iterator_range_tag>
{
private:
template<typename Iterator>
struct is_segmented_iterator
: mpl::false_
{};
template<typename Iterator>
struct is_segmented_iterator<Iterator &>
: is_segmented_iterator<Iterator>
{};
template<typename Iterator>
struct is_segmented_iterator<Iterator const>
: is_segmented_iterator<Iterator>
{};
template<typename Context>
struct is_segmented_iterator<segmented_iterator<Context> >
: mpl::true_
{};
public:
template<typename Sequence>
struct apply
: 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);
};
};
template<typename Tag>
struct segments_impl;
template<>
struct segments_impl<iterator_range_tag>
{
template<typename Sequence>
struct apply
{
typedef
detail::make_segmented_range<
typename Sequence::begin_type,
typename Sequence::end_type
>
impl;
BOOST_MPL_ASSERT((traits::is_segmented<typename impl::type>));
typedef
typename result_of::segments<typename impl::type>::type
type;
static type call(Sequence & seq)
{
return fusion::segments(impl::call(seq.first, seq.last));
}
};
};
// TODO: default implementation of begin, end, and size
// should check if the sequence is segmented and to
// the right thing.
}}}
#endif

View File

@ -0,0 +1,52 @@
/*=============================================================================
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_ITERATOR_RANGE_SEGMENTS_HPP_INCLUDED)
#define BOOST_FUSION_ITERATOR_RANGE_SEGMENTS_HPP_INCLUDED
#include <boost/mpl/assert.hpp>
#include <boost/fusion/sequence/intrinsic/segments.hpp>
#include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp>
namespace boost { namespace fusion
{
struct iterator_range_tag;
namespace extension
{
template <typename Tag>
struct segments_impl;
template <>
struct segments_impl<iterator_range_tag>
{
template <typename Sequence>
struct apply
{
typedef
detail::make_segmented_range<
typename Sequence::begin_type,
typename Sequence::end_type
>
impl;
BOOST_MPL_ASSERT((traits::is_segmented<typename impl::type>));
typedef
typename result_of::segments<typename impl::type>::type
type;
static type call(Sequence & seq)
{
return fusion::segments(impl::call(seq.first, seq.last));
}
};
};
}
}}
#endif

View File

@ -17,6 +17,8 @@
#include <boost/fusion/view/iterator_range/detail/at_impl.hpp>
#include <boost/fusion/view/iterator_range/detail/size_impl.hpp>
#include <boost/fusion/view/iterator_range/detail/value_at_impl.hpp>
#include <boost/fusion/view/iterator_range/detail/is_segmented_impl.hpp>
#include <boost/fusion/view/iterator_range/detail/segments_impl.hpp>
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
#include <boost/config.hpp>

View File

@ -30,7 +30,7 @@ void test_set(Set const& set)
using namespace boost::fusion;
std::cout << set << std::endl;
BOOST_STATIC_ASSERT(result_of::size<Set>::value == 3);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<Set>::value == 3);
BOOST_TEST((*find<int>(set) == 1));
BOOST_TEST((*find<double>(set) == 1.5));
BOOST_TEST((*find<std::string>(set) == "hello"));
@ -47,7 +47,7 @@ void test_map(Map const& map)
using namespace boost::fusion;
std::cout << map << std::endl;
BOOST_STATIC_ASSERT(result_of::size<Map>::value == 3);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<Map>::value == 3);
BOOST_TEST(((*find<_1>(map)).second == 1));
BOOST_TEST(((*find<_3>(map)).second == 1.5));
BOOST_TEST(((*find<_4>(map)).second == std::string("hello")));

View File

@ -59,7 +59,7 @@ struct sum
template<typename Self, typename State, typename T>
struct result<Self(State,T)>
: fusion::result_of::make_pair<
: boost::fusion::result_of::make_pair<
mpl::int_<
boost::remove_reference<
State
@ -108,7 +108,7 @@ struct meta_sum
#ifdef BOOST_FUSION_TEST_ITER_FOLD
typedef typename
fusion::result_of::value_of<
boost::fusion::result_of::value_of<
typename boost::remove_reference<T>::type
>::type
t;
@ -144,7 +144,7 @@ struct fold_test_n
{
mpl::range_c<int, 1, n+1> init_range;
typename fusion::result_of::as_vector<
typename boost::fusion::result_of::as_vector<
typename mpl::transform<
range
, mpl::always<int>
@ -169,20 +169,20 @@ struct fold_test_n
{
typedef typename
#ifdef BOOST_FUSION_TEST_REVERSE_FOLD
fusion::result_of::as_vector<
boost::fusion::result_of::as_vector<
typename mpl::copy<
mpl::range_c<int, 1, n+1>
, mpl::front_inserter<fusion::vector<> >
>::type
>::type
#else
fusion::result_of::as_vector<mpl::range_c<int, 1, n+1> >::type
boost::fusion::result_of::as_vector<mpl::range_c<int, 1, n+1> >::type
#endif
vec;
typedef
boost::is_same<
typename fusion::result_of::BOOST_FUSION_TEST_FOLD_NAME<
typename boost::fusion::result_of::BOOST_FUSION_TEST_FOLD_NAME<
vec
, mpl::vector<mpl::int_<1>, mpl::int_<0> >
, meta_sum

View File

@ -19,9 +19,9 @@ process_tree(Tree const &tree)
{
using namespace boost;
typedef typename fusion::result_of::find_s<Tree const, short>::type short_iter;
typedef typename fusion::result_of::find_s<Tree const, float>::type float_iter;
typedef typename fusion::result_of::find_s<Tree const, not_there>::type not_there_iter;
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;
// find_if_s of a segmented data structure returns generic
// segmented iterators

View File

@ -22,9 +22,9 @@ process_tree(Tree const &tree)
using namespace boost;
using mpl::_;
typedef typename fusion::result_of::find_if_s<Tree const, is_same<_,short> >::type short_iter;
typedef typename fusion::result_of::find_if_s<Tree const, is_same<_,float> >::type float_iter;
typedef typename fusion::result_of::find_if_s<Tree const, is_same<_,not_there> >::type not_there_iter;
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;
// find_if_s of a segmented data structure returns generic
// segmented iterators

View File

@ -109,46 +109,46 @@ main()
{
typedef range_c<int, 5, 9> sequence_type;
sequence_type sequence;
std::cout << transform(sequence, square()) << std::endl;
BOOST_TEST((transform(sequence, square()) == make_vector(25, 36, 49, 64)));
std::cout << boost::fusion::transform(sequence, square()) << std::endl;
BOOST_TEST((boost::fusion::transform(sequence, square()) == make_vector(25, 36, 49, 64)));
}
{
typedef range_c<int, 5, 9> mpl_list1;
std::cout << transform(mpl_list1(), square()) << std::endl;
BOOST_TEST((transform(mpl_list1(), square()) == make_vector(25, 36, 49, 64)));
std::cout << boost::fusion::transform(mpl_list1(), square()) << std::endl;
BOOST_TEST((boost::fusion::transform(mpl_list1(), square()) == make_vector(25, 36, 49, 64)));
}
{
vector<int, int, int> tup(1, 2, 3);
std::cout << transform(tup, square()) << std::endl;
BOOST_TEST((transform(tup, square()) == make_vector(1, 4, 9)));
std::cout << boost::fusion::transform(tup, square()) << std::endl;
BOOST_TEST((boost::fusion::transform(tup, square()) == make_vector(1, 4, 9)));
}
{
vector<int, int, int> tup1(1, 2, 3);
vector<int, int, int> tup2(4, 5, 6);
std::cout << transform(tup1, tup2, add()) << std::endl;
BOOST_TEST((transform(tup1, tup2, add()) == make_vector(5, 7, 9)));
std::cout << boost::fusion::transform(tup1, tup2, add()) << std::endl;
BOOST_TEST((boost::fusion::transform(tup1, tup2, add()) == make_vector(5, 7, 9)));
}
{
// Unary transform that requires lvalues, just check compilation
vector<int, int, int> tup1(1, 2, 3);
BOOST_TEST(at_c<0>(transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1));
BOOST_TEST(*begin(transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1));
BOOST_TEST(at_c<0>(boost::fusion::transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1));
BOOST_TEST(*begin(boost::fusion::transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1));
}
{
vector<int, int, int> tup1(1, 2, 3);
vector<int, int, int> tup2(4, 5, 6);
BOOST_TEST(at_c<0>(transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1));
BOOST_TEST(*begin(transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1));
BOOST_TEST(at_c<0>(boost::fusion::transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1));
BOOST_TEST(*begin(boost::fusion::transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1));
}
{
vector<int, int, int> tup1(1, 2, 3);
BOOST_TEST(transform(tup1, twice) == make_vector(2,4,6));
BOOST_TEST(boost::fusion::transform(tup1, twice) == make_vector(2,4,6));
}

View File

@ -38,17 +38,17 @@ namespace
fusion::at_c<8>(v);
fusion::at_c<9>(v);
typedef typename fusion::result_of::value_at_c<v_type, 0>::type va0;
typedef typename fusion::result_of::value_at_c<v_type, 1>::type va1;
typedef typename fusion::result_of::value_at_c<v_type, 2>::type va2;
typedef typename fusion::result_of::value_at_c<v_type, 3>::type va3;
typedef typename fusion::result_of::value_at_c<v_type, 4>::type va4;
typedef typename boost::fusion::result_of::value_at_c<v_type, 0>::type va0;
typedef typename boost::fusion::result_of::value_at_c<v_type, 1>::type va1;
typedef typename boost::fusion::result_of::value_at_c<v_type, 2>::type va2;
typedef typename boost::fusion::result_of::value_at_c<v_type, 3>::type va3;
typedef typename boost::fusion::result_of::value_at_c<v_type, 4>::type va4;
typedef typename fusion::result_of::value_at_c<v_type, 5>::type va5;
typedef typename fusion::result_of::value_at_c<v_type, 6>::type va6;
typedef typename fusion::result_of::value_at_c<v_type, 7>::type va7;
typedef typename fusion::result_of::value_at_c<v_type, 8>::type va8;
typedef typename fusion::result_of::value_at_c<v_type, 9>::type va9;
typedef typename boost::fusion::result_of::value_at_c<v_type, 5>::type va5;
typedef typename boost::fusion::result_of::value_at_c<v_type, 6>::type va6;
typedef typename boost::fusion::result_of::value_at_c<v_type, 7>::type va7;
typedef typename boost::fusion::result_of::value_at_c<v_type, 8>::type va8;
typedef typename boost::fusion::result_of::value_at_c<v_type, 9>::type va9;
fusion::begin(v);
fusion::end(v);

View File

@ -331,7 +331,7 @@ void test_sequence_n(Sequence & seq, mpl::int_<3>)
template <class Sequence>
void test_sequence(Sequence & seq)
{
test_sequence_n(seq, mpl::int_<fusion::result_of::size<Sequence>::value>());
test_sequence_n(seq, mpl::int_<boost::fusion::result_of::size<Sequence>::value>());
}
@ -340,18 +340,18 @@ void result_type_tests()
using boost::is_same;
BOOST_TEST(( is_same<
fusion::result_of::invoke<int (*)(), fusion::vector0<> >::type, int
boost::fusion::result_of::invoke<int (*)(), fusion::vector0<> >::type, int
>::value ));
// disabled until boost::result_of supports it
// BOOST_TEST(( is_same<
// fusion::result_of::invoke<int (*)(...), fusion::vector1<int> >::type, int
// boost::fusion::result_of::invoke<int (*)(...), fusion::vector1<int> >::type, int
// >::value ));
BOOST_TEST(( is_same<
fusion::result_of::invoke<int (members::*)(), fusion::vector1<members*> >::type, int
boost::fusion::result_of::invoke<int (members::*)(), fusion::vector1<members*> >::type, int
>::value ));
// disabled until boost::result_of supports it
// BOOST_TEST(( is_same<
// fusion::result_of::invoke<int (members::*)(...), fusion::vector2<members*,int> >::type, int
// boost::fusion::result_of::invoke<int (members::*)(...), fusion::vector2<members*,int> >::type, int
// >::value ));
}

View File

@ -182,16 +182,16 @@ void test_sequence_n(Sequence & seq, mpl::int_<3>)
template <class Sequence>
void test_sequence(Sequence & seq)
{
test_sequence_n(seq, mpl::int_<fusion::result_of::size<Sequence>::value>());
test_sequence_n(seq, mpl::int_<boost::fusion::result_of::size<Sequence>::value>());
}
void result_type_tests()
{
using boost::is_same;
BOOST_TEST(( is_same< fusion::result_of::invoke_function_object< nullary_fobj, fusion::vector<> >::type, int >::value ));
BOOST_TEST(( is_same< fusion::result_of::invoke_function_object< fobj, fusion::vector<element1_type> >::type, int >::value ));
BOOST_TEST(( is_same< fusion::result_of::invoke_function_object< fobj, fusion::vector<element1_type,element2_type> >::type, int >::value ));
BOOST_TEST(( is_same< boost::fusion::result_of::invoke_function_object< nullary_fobj, fusion::vector<> >::type, int >::value ));
BOOST_TEST(( is_same< boost::fusion::result_of::invoke_function_object< fobj, fusion::vector<element1_type> >::type, int >::value ));
BOOST_TEST(( is_same< boost::fusion::result_of::invoke_function_object< fobj, fusion::vector<element1_type,element2_type> >::type, int >::value ));
}

View File

@ -244,7 +244,7 @@ void test_sequence_n(Sequence & seq, mpl::int_<3>)
template <class Sequence>
void test_sequence(Sequence & seq)
{
test_sequence_n(seq, mpl::int_<fusion::result_of::size<Sequence>::value>());
test_sequence_n(seq, mpl::int_<boost::fusion::result_of::size<Sequence>::value>());
}
int main()

View File

@ -63,7 +63,7 @@ int main()
test_func<> f;
test_func<noncopyable> f_nc;
fusion::result_of::make_fused< test_func<> >::type fused_func
boost::fusion::result_of::make_fused< test_func<> >::type fused_func
= fusion::make_fused(f);
BOOST_TEST(fused_func(lv_vec) == 1);

View File

@ -73,7 +73,7 @@ int main()
test_func<> f;
test_func<noncopyable> f_nc;
fusion::result_of::make_fused_function_object< test_func<> >::type fused_func
boost::fusion::result_of::make_fused_function_object< test_func<> >::type fused_func
= fusion::make_fused_function_object(f);
BOOST_TEST(fused_func(lv_vec) == 1);

View File

@ -69,7 +69,7 @@ int main()
test_func<> f;
test_func<noncopyable> f_nc;
fusion::result_of::make_fused_procedure< test_func<> >::type fused_func
boost::fusion::result_of::make_fused_procedure< test_func<> >::type fused_func
= fusion::make_fused_procedure(f);
CHECK_EFFECT(fused_func(lv_vec), 1);

View File

@ -42,7 +42,7 @@ struct test_func
template <class Self, class Seq>
struct result< Self(Seq &) >
: mpl::if_< mpl::and_< fusion::result_of::empty<Seq>, RemoveNullary >,
: mpl::if_< mpl::and_< boost::fusion::result_of::empty<Seq>, RemoveNullary >,
boost::blank, mpl::identity<long> >::type
{ };
@ -86,14 +86,14 @@ int main()
test_func<> f;
test_func<noncopyable> f_nc;
fusion::result_of::make_unfused< test_func<> >::type unfused_func =
boost::fusion::result_of::make_unfused< test_func<> >::type unfused_func =
fusion::make_unfused(f);
fusion::result_of::make_unfused< boost::reference_wrapper<
boost::fusion::result_of::make_unfused< boost::reference_wrapper<
test_func<noncopyable> > >::type unfused_func_ref =
fusion::make_unfused(ref(f_nc));
fusion::result_of::make_unfused< boost::reference_wrapper<
boost::fusion::result_of::make_unfused< boost::reference_wrapper<
test_func<noncopyable> const> >::type unfused_func_c_ref =
fusion::make_unfused(cref(f_nc));

View File

@ -148,7 +148,7 @@ main()
{
BOOST_MPL_ASSERT((mpl::is_sequence<ns::point>));
BOOST_MPL_ASSERT((boost::is_same<
fusion::result_of::value_at_c<ns::point,0>::type
boost::fusion::result_of::value_at_c<ns::point,0>::type
, mpl::front<ns::point>::type>));
}
@ -166,8 +166,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<ns::point_with_private_members>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<ns::point_with_private_members>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point_with_private_members>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point_with_private_members>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -177,22 +177,22 @@ main()
{
BOOST_MPL_ASSERT((
boost::is_same<
result_of::front<ns::point>::type,
boost::fusion::result_of::front<ns::point>::type,
boost::fusion::extension::adt_attribute_proxy<ns::point,0,false>
>));
BOOST_MPL_ASSERT((
boost::is_same<
result_of::front<ns::point>::type::type,
boost::fusion::result_of::front<ns::point>::type::type,
int
>));
BOOST_MPL_ASSERT((
boost::is_same<
result_of::front<ns::point const>::type,
boost::fusion::result_of::front<ns::point const>::type,
boost::fusion::extension::adt_attribute_proxy<ns::point,0,true>
>));
BOOST_MPL_ASSERT((
boost::is_same<
result_of::front<ns::point const>::type::type,
boost::fusion::result_of::front<ns::point const>::type::type,
int
>));
}

View File

@ -83,8 +83,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<adapted::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -127,7 +127,7 @@ main()
{
BOOST_MPL_ASSERT((mpl::is_sequence<adapted::point>));
BOOST_MPL_ASSERT((boost::is_same<
fusion::result_of::value_at_c<adapted::point,0>::type
boost::fusion::result_of::value_at_c<adapted::point,0>::type
, mpl::front<adapted::point>::type>));
}

View File

@ -73,8 +73,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<ns::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -117,12 +117,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<ns::point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<ns::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<ns::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<ns::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<ns::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<ns::point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::y_member>::type, int>));
ns::point p(5, 3);

View File

@ -75,8 +75,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<adapted::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -122,12 +122,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<adapted::point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<adapted::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<adapted::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<adapted::point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<adapted::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<adapted::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<adapted::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<adapted::point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<adapted::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<adapted::point, ns::y_member>::type, int>));
ns::point basep(5, 3);
adapted::point p(basep);

View File

@ -79,8 +79,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<ns::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -116,12 +116,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((fusion::result_of::has_key<ns::point, ns::x_member>));
BOOST_MPL_ASSERT((fusion::result_of::has_key<ns::point, ns::y_member>));
BOOST_MPL_ASSERT((mpl::not_<fusion::result_of::has_key<ns::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::y_member>));
BOOST_MPL_ASSERT((mpl::not_<boost::fusion::result_of::has_key<ns::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<fusion::result_of::value_at_key<ns::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<fusion::result_of::value_at_key<ns::point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::y_member>::type, int>));
ns::point p = {5, 3};
@ -132,7 +132,7 @@ main()
{
BOOST_MPL_ASSERT((mpl::is_sequence<ns::point>));
BOOST_MPL_ASSERT((boost::is_same<
fusion::result_of::value_at_c<ns::point,0>::type
boost::fusion::result_of::value_at_c<ns::point,0>::type
, mpl::front<ns::point>::type>));
}

View File

@ -61,8 +61,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<adapted::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -102,12 +102,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<adapted::point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<adapted::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<adapted::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<adapted::point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<adapted::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<adapted::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<adapted::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<adapted::point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<adapted::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<adapted::point, ns::y_member>::type, int>));
ns::point basep = {5, 3};
adapted::point p(basep);

View File

@ -77,8 +77,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -121,12 +121,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::y_member>::type, int>));
point p(5, 3);

View File

@ -78,8 +78,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -115,12 +115,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::y_member>::type, int>));
point p = {5, 3};

View File

@ -96,8 +96,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<ns::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -135,16 +135,16 @@ main()
using namespace boost::fusion;
using boost::is_same;
typedef result_of::begin<s>::type b;
typedef result_of::end<s>::type e;
typedef boost::fusion::result_of::begin<s>::type b;
typedef boost::fusion::result_of::end<s>::type e;
// this fails
BOOST_MPL_ASSERT((is_same<result_of::next<b>::type, e>));
BOOST_MPL_ASSERT((is_same<boost::fusion::result_of::next<b>::type, e>));
}
{
BOOST_MPL_ASSERT((mpl::is_sequence<ns::point>));
BOOST_MPL_ASSERT((boost::is_same<
fusion::result_of::value_at_c<ns::point,0>::type
boost::fusion::result_of::value_at_c<ns::point,0>::type
, mpl::front<ns::point>::type>));
}

View File

@ -75,8 +75,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<adapted::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -118,17 +118,17 @@ main()
using namespace boost::fusion;
using boost::is_same;
typedef result_of::begin<ns1::s1>::type b;
typedef result_of::end<ns1::s1>::type e;
typedef boost::fusion::result_of::begin<ns1::s1>::type b;
typedef boost::fusion::result_of::end<ns1::s1>::type e;
// this fails
BOOST_MPL_ASSERT((is_same<result_of::next<b>::type, e>));
BOOST_MPL_ASSERT((is_same<boost::fusion::result_of::next<b>::type, e>));
}
{
BOOST_MPL_ASSERT((mpl::is_sequence<adapted::point>));
BOOST_MPL_ASSERT((boost::is_same<
fusion::result_of::value_at_c<adapted::point,0>::type
boost::fusion::result_of::value_at_c<adapted::point,0>::type
, mpl::front<adapted::point>::type>));
}

View File

@ -85,8 +85,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);

View File

@ -73,8 +73,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -111,10 +111,10 @@ main()
{ // begin/end
using namespace boost::fusion;
typedef result_of::begin<s<int> >::type b;
typedef result_of::end<s<int> >::type e;
typedef boost::fusion::result_of::begin<s<int> >::type b;
typedef boost::fusion::result_of::end<s<int> >::type e;
// this fails
BOOST_MPL_ASSERT((boost::is_same<result_of::next<b>::type, e>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::next<b>::type, e>));
}
return boost::report_errors();

View File

@ -82,65 +82,65 @@ int main()
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::value_at_key<et, keys::name>::type,
boost::fusion::result_of::value_at_key<et, keys::name>::type,
std::string
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::value_at_key<et, keys::name>::type,
fusion::result_of::value_at_c<et, 0>::type
boost::fusion::result_of::value_at_key<et, keys::name>::type,
boost::fusion::result_of::value_at_c<et, 0>::type
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::value_at_key<et, keys::age>::type,
boost::fusion::result_of::value_at_key<et, keys::age>::type,
int
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::value_at_key<et, keys::age>::type,
fusion::result_of::value_at_c<et, 1>::type
boost::fusion::result_of::value_at_key<et, keys::age>::type,
boost::fusion::result_of::value_at_c<et, 1>::type
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<et, keys::name>::type,
boost::fusion::result_of::at_key<et, keys::name>::type,
fusion::extension::adt_attribute_proxy<et, 0, false>
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<et, keys::age>::type,
boost::fusion::result_of::at_key<et, keys::age>::type,
fusion::extension::adt_attribute_proxy<et, 1, false>
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<et, keys::name>::type,
fusion::result_of::front<et>::type
boost::fusion::result_of::at_key<et, keys::name>::type,
boost::fusion::result_of::front<et>::type
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<et, keys::age>::type,
fusion::result_of::back<et>::type
boost::fusion::result_of::at_key<et, keys::age>::type,
boost::fusion::result_of::back<et>::type
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<etc, keys::name>::type,
boost::fusion::result_of::at_key<etc, keys::name>::type,
fusion::extension::adt_attribute_proxy<et, 0, true>
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<etc, keys::age>::type,
boost::fusion::result_of::at_key<etc, keys::age>::type,
fusion::extension::adt_attribute_proxy<et, 1, true>
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<etc, keys::name>::type,
fusion::result_of::front<etc>::type
boost::fusion::result_of::at_key<etc, keys::name>::type,
boost::fusion::result_of::front<etc>::type
>));
BOOST_MPL_ASSERT((
boost::is_same<
fusion::result_of::at_key<etc, keys::age>::type,
fusion::result_of::back<etc>::type
boost::fusion::result_of::at_key<etc, keys::age>::type,
boost::fusion::result_of::back<etc>::type
>));
BOOST_MPL_ASSERT((

View File

@ -36,7 +36,7 @@ main()
{
typedef pair<int, char> p1;
typedef pair<double, std::string> p2;
result_of::as_map<list<p1, p2> >::type map(make_pair<int>('X'), make_pair<double>("Men"));
boost::fusion::result_of::as_map<list<p1, p2> >::type map(make_pair<int>('X'), make_pair<double>("Men"));
std::cout << at_key<int>(map) << std::endl;
std::cout << at_key<double>(map) << std::endl;
BOOST_TEST(at_key<int>(map) == 'X');

View File

@ -40,7 +40,7 @@ main()
}
{
result_of::as_set<list<int, double, std::string> >::type set(1, 1.23, "harru");
boost::fusion::result_of::as_set<list<int, double, std::string> >::type set(1, 1.23, "harru");
std::cout << at_key<int>(set) << std::endl;
BOOST_TEST(at_key<int>(set) == 1);
}

View File

@ -56,8 +56,8 @@ main()
at_c<1>(t) = "mama mia";
BOOST_TEST(t == make_vector(6, "mama mia"));
BOOST_STATIC_ASSERT(result_of::size<tuple_type>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<tuple_type>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<tuple_type>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<tuple_type>::value);
BOOST_TEST(front(t) == 6);
}

View File

@ -51,8 +51,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<ns::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -88,12 +88,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<ns::point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<ns::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<ns::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<ns::point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<ns::point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<ns::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<ns::point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<ns::point, ns::y_member>::type, int>));
ns::point p(5, 3);

View File

@ -55,8 +55,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -92,12 +92,12 @@ main()
{
// assoc stuff
BOOST_MPL_ASSERT((result_of::has_key<point, ns::x_member>));
BOOST_MPL_ASSERT((result_of::has_key<point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<result_of::has_key<point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::x_member>));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<point, ns::y_member>));
BOOST_MPL_ASSERT((boost::mpl::not_<boost::fusion::result_of::has_key<point, ns::z_member> >));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_at_key<point, ns::y_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::x_member>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_at_key<point, ns::y_member>::type, int>));
point p(5, 3);

View File

@ -48,8 +48,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<ns::point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -86,10 +86,10 @@ main()
{ // begin/end
using namespace boost::fusion;
typedef result_of::begin<s>::type b;
typedef result_of::end<s>::type e;
typedef boost::fusion::result_of::begin<s>::type b;
typedef boost::fusion::result_of::end<s>::type e;
// this fails
BOOST_MPL_ASSERT((boost::is_same<result_of::next<b>::type, e>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::next<b>::type, e>));
}
{

View File

@ -51,8 +51,8 @@ main()
at_c<1>(p) = 9;
BOOST_TEST(p == make_vector(6, 9));
BOOST_STATIC_ASSERT(result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<point>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<point>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<point>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == 9);
@ -89,10 +89,10 @@ main()
{ // begin/end
using namespace boost::fusion;
typedef result_of::begin<s<int> >::type b;
typedef result_of::end<s<int> >::type e;
typedef boost::fusion::result_of::begin<s<int> >::type b;
typedef boost::fusion::result_of::end<s<int> >::type e;
// this fails
BOOST_MPL_ASSERT((boost::is_same<result_of::next<b>::type, e>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::next<b>::type, e>));
}

View File

@ -77,7 +77,7 @@ main()
filter_view_type view(v);
std::cout << view << std::endl;
BOOST_TEST((view == make_vector('@', 987654, true, 6.6)));
BOOST_STATIC_ASSERT(result_of::size<filter_view_type>::value == 4);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<filter_view_type>::value == 4);
}
//cschmidt: This is illegal C++. ADL instantiates less<_, int_<3> > - which
@ -94,7 +94,7 @@ main()
filter_view_type view(v);
std::cout << view << std::endl;
BOOST_TEST((view == make_vector(1, 2, 0, -1)));
BOOST_STATIC_ASSERT(result_of::size<filter_view_type>::value == 4);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<filter_view_type>::value == 4);
#endif
}*/
@ -104,7 +104,7 @@ main()
typedef vector<int> vec;
typedef filter_view<vec, reject_all> filter_view_type;
BOOST_MPL_ASSERT((result_of::equal_to<result_of::begin<filter_view_type>::type, result_of::end<filter_view_type>::type>));
BOOST_MPL_ASSERT((boost::fusion::result_of::equal_to<boost::fusion::result_of::begin<filter_view_type>::type, boost::fusion::result_of::end<filter_view_type>::type>));
}
{
@ -114,11 +114,11 @@ main()
typedef filter_view<map_type const, is_same<_, pair<double, std::string> > > filter_view_type;
filter_view_type f(m);
BOOST_MPL_ASSERT((result_of::has_key<filter_view_type, double>::type));
BOOST_MPL_ASSERT_NOT((result_of::has_key<filter_view_type, void>::type));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<filter_view_type, double>::type));
BOOST_MPL_ASSERT_NOT((boost::fusion::result_of::has_key<filter_view_type, void>::type));
BOOST_MPL_ASSERT((is_same<result_of::key_of<result_of::begin<filter_view_type>::type>::type, double>));
BOOST_MPL_ASSERT((is_same<result_of::value_of_data<result_of::begin<filter_view_type>::type>::type, std::string>));
BOOST_MPL_ASSERT((is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<filter_view_type>::type>::type, double>));
BOOST_MPL_ASSERT((is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<filter_view_type>::type>::type, std::string>));
std::cout << deref_data(begin(f)) << std::endl;
BOOST_TEST((deref_data(begin(f)) == "Bond"));

View File

@ -30,7 +30,7 @@ void test()
char const* s = "Hello";
typedef FUSION_SEQUENCE<int, char, double, char const*> seq_type;
seq_type v(1, 'x', 3.3, s);
result_of::begin<seq_type>::type i(v);
boost::fusion::result_of::begin<seq_type>::type i(v);
BOOST_TEST(*i == 1);
BOOST_TEST(*next(i) == 'x');
@ -62,7 +62,7 @@ void test()
char const* s = "Hello";
typedef FUSION_SEQUENCE<int, char, double, char const*> const seq_type;
seq_type t(1, 'x', 3.3, s);
result_of::begin<seq_type>::type i(t);
boost::fusion::result_of::begin<seq_type>::type i(t);
BOOST_TEST(*i == 1);
BOOST_TEST(*next(i) == 'x');
@ -80,22 +80,22 @@ void test()
typedef FUSION_SEQUENCE<int, char, double, char const*> seq_type;
typedef FUSION_SEQUENCE<int, char, double, char const*> const cseq_type;
typedef result_of::begin<seq_type>::type vi1;
typedef result_of::begin<cseq_type>::type vi2;
BOOST_STATIC_ASSERT((result_of::equal_to<vi1 const, vi1>::value));
BOOST_STATIC_ASSERT((result_of::equal_to<vi1, vi1 const>::value));
BOOST_STATIC_ASSERT((result_of::equal_to<vi1, vi2>::value));
BOOST_STATIC_ASSERT((result_of::equal_to<vi1 const, vi2>::value));
BOOST_STATIC_ASSERT((result_of::equal_to<vi1, vi2 const>::value));
BOOST_STATIC_ASSERT((result_of::equal_to<vi1 const, vi2 const>::value));
typedef boost::fusion::result_of::begin<seq_type>::type vi1;
typedef boost::fusion::result_of::begin<cseq_type>::type vi2;
BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1 const, vi1>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1, vi1 const>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1, vi2>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1 const, vi2>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1, vi2 const>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::equal_to<vi1 const, vi2 const>::value));
}
{
typedef FUSION_SEQUENCE<int, int> seq_type;
typedef result_of::begin<seq_type>::type begin_type;
typedef result_of::end<seq_type>::type end_type;
typedef result_of::next<begin_type>::type i1;
typedef result_of::next<i1>::type i2;
typedef boost::fusion::result_of::begin<seq_type>::type begin_type;
typedef boost::fusion::result_of::end<seq_type>::type end_type;
typedef boost::fusion::result_of::next<begin_type>::type i1;
typedef boost::fusion::result_of::next<i1>::type i2;
BOOST_STATIC_ASSERT((is_same<end_type, i2>::value));
}
@ -105,7 +105,7 @@ void test()
char const* s = "Hello";
typedef FUSION_SEQUENCE<int, char, double, char const*> seq_type;
seq_type t(1, 'x', 3.3, s);
result_of::begin<seq_type>::type i(t);
boost::fusion::result_of::begin<seq_type>::type i(t);
BOOST_TEST(*i == 1);
BOOST_TEST(*next(i) == 'x');
@ -138,34 +138,34 @@ void test()
typedef FUSION_SEQUENCE<int, char, double, char const*> seq_type;
seq_type t(1, 'x', 3.3, "Hello");
BOOST_STATIC_ASSERT((result_of::distance<
result_of::begin<seq_type>::type
, result_of::end<seq_type>::type >::value == 4));
BOOST_STATIC_ASSERT((boost::fusion::result_of::distance<
boost::fusion::result_of::begin<seq_type>::type
, boost::fusion::result_of::end<seq_type>::type >::value == 4));
BOOST_TEST(distance(begin(t), end(t)).value == 4);
}
{ // Testing tuple iterator result_of::value_of, result_of::deref, result_of::value_at
{ // Testing tuple iterator boost::fusion::result_of::value_of, boost::fusion::result_of::deref, boost::fusion::result_of::value_at
typedef FUSION_SEQUENCE<int, char&> seq_type;
typedef result_of::begin<seq_type>::type i0;
typedef result_of::next<i0>::type i1;
typedef result_of::next<result_of::begin<const seq_type>::type>::type i2;
typedef boost::fusion::result_of::begin<seq_type>::type i0;
typedef boost::fusion::result_of::next<i0>::type i1;
typedef boost::fusion::result_of::next<boost::fusion::result_of::begin<const seq_type>::type>::type i2;
BOOST_STATIC_ASSERT((
is_same<result_of::value_at_c<seq_type, 0>::type, int>::value));
is_same<boost::fusion::result_of::value_at_c<seq_type, 0>::type, int>::value));
BOOST_STATIC_ASSERT((
is_same<result_of::value_at_c<seq_type, 1>::type, char&>::value));
is_same<boost::fusion::result_of::value_at_c<seq_type, 1>::type, char&>::value));
BOOST_STATIC_ASSERT((
is_same<traits::category_of<i0>::type, FUSION_TRAVERSAL_TAG>::value));
BOOST_STATIC_ASSERT((is_same<result_of::deref<i0>::type, int&>::value));
BOOST_STATIC_ASSERT((is_same<result_of::deref<i1>::type, char&>::value));
BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::deref<i0>::type, int&>::value));
BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::deref<i1>::type, char&>::value));
BOOST_STATIC_ASSERT((is_same<result_of::value_of<i0>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<result_of::value_of<i1>::type, char&>::value));
BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::value_of<i0>::type, int>::value));
BOOST_STATIC_ASSERT((is_same<boost::fusion::result_of::value_of<i1>::type, char&>::value));
}
{ // Testing advance

View File

@ -50,7 +50,7 @@ main()
slice_t slice(i1, i3);
std::cout << slice << std::endl;
BOOST_TEST((slice == make_vector('x', 3.3)));
BOOST_STATIC_ASSERT(result_of::size<slice_t>::value == 2);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 2);
}
{
@ -64,7 +64,7 @@ main()
slice_t slice(i1, i3);
std::cout << slice << std::endl;
BOOST_TEST(slice == make_vector());
BOOST_STATIC_ASSERT(result_of::size<slice_t>::value == 0);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 0);
}
}
@ -82,7 +82,7 @@ main()
slice_t slice(f, l);
std::cout << slice << std::endl;
BOOST_TEST((slice == make_vector(3, 4)));
BOOST_STATIC_ASSERT(result_of::size<slice_t>::value == 2);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 2);
}
{
@ -90,19 +90,19 @@ main()
map_type m(make_pair<void>("foo"), make_pair<double>('x'), make_pair<void*>(2));
typedef iterator_range<
result_of::begin<map_type>::type
, result_of::advance_c<result_of::begin<map_type>::type,2>::type
boost::fusion::result_of::begin<map_type>::type
, boost::fusion::result_of::advance_c<boost::fusion::result_of::begin<map_type>::type,2>::type
> range_type;
range_type r(begin(m), advance_c<2>(begin(m)));
BOOST_MPL_ASSERT((result_of::has_key<range_type, void>::type));
BOOST_MPL_ASSERT((result_of::has_key<range_type, double>::type));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<range_type, void>::type));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<range_type, double>::type));
BOOST_MPL_ASSERT((boost::is_same<result_of::key_of<result_of::begin<range_type>::type>::type, void>));
BOOST_MPL_ASSERT((boost::is_same<result_of::key_of<result_of::next<result_of::begin<range_type>::type>::type>::type, double>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<range_type>::type>::type, void>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<range_type>::type>::type>::type, double>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of_data<result_of::begin<range_type>::type>::type, std::string>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of_data<result_of::next<result_of::begin<range_type>::type>::type>::type, char>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<range_type>::type>::type, std::string>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<range_type>::type>::type>::type, char>));
std::cout << deref_data(begin(r)) << std::endl;
std::cout << deref_data(fusion::next(begin(r))) << std::endl;

View File

@ -159,20 +159,20 @@ main()
typedef joint_view<map_type, set_type> joint_view_type;
joint_view_type j(m,s);
BOOST_MPL_ASSERT((result_of::has_key<joint_view_type, void>::type));
BOOST_MPL_ASSERT((result_of::has_key<joint_view_type, std::string>::type));
BOOST_MPL_ASSERT((result_of::has_key<joint_view_type, float>::type));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<joint_view_type, void>::type));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<joint_view_type, std::string>::type));
BOOST_MPL_ASSERT((boost::fusion::result_of::has_key<joint_view_type, float>::type));
BOOST_MPL_ASSERT((boost::is_same<result_of::key_of<result_of::begin<joint_view_type>::type>::type, void>));
BOOST_MPL_ASSERT((boost::is_same<result_of::key_of<result_of::next<result_of::begin<joint_view_type>::type>::type>::type, std::string>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<joint_view_type>::type>::type, void>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<joint_view_type>::type>::type>::type, std::string>));
BOOST_MPL_ASSERT((boost::is_same<
result_of::key_of<result_of::next<result_of::next<result_of::begin<joint_view_type>::type>::type>::type>::type
boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<joint_view_type>::type>::type>::type>::type
, float>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of_data<result_of::begin<joint_view_type>::type>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<result_of::value_of_data<result_of::next<result_of::begin<joint_view_type>::type>::type>::type, std::string>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<joint_view_type>::type>::type, int>));
BOOST_MPL_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<joint_view_type>::type>::type>::type, std::string>));
BOOST_MPL_ASSERT((boost::is_same<
result_of::value_of_data<result_of::next<result_of::next<result_of::begin<joint_view_type>::type>::type>::type>::type
boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::next<boost::fusion::result_of::begin<joint_view_type>::type>::type>::type>::type
, float>));
std::cout << deref_data(begin(j)) << std::endl;

View File

@ -55,15 +55,15 @@ main()
BOOST_TEST(at_key<double>(m) == "Men");
BOOST_STATIC_ASSERT((
boost::is_same<result_of::value_at_key<map_type, int>::type, char>::value));
boost::is_same<boost::fusion::result_of::value_at_key<map_type, int>::type, char>::value));
BOOST_STATIC_ASSERT((
boost::is_same<result_of::value_at_key<map_type, double>::type, std::string>::value));
boost::is_same<boost::fusion::result_of::value_at_key<map_type, double>::type, std::string>::value));
std::cout << m << std::endl;
BOOST_STATIC_ASSERT((result_of::has_key<map_type, int>::value));
BOOST_STATIC_ASSERT((result_of::has_key<map_type, double>::value));
BOOST_STATIC_ASSERT((!result_of::has_key<map_type, std::string>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<map_type, int>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<map_type, double>::value));
BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key<map_type, std::string>::value));
std::cout << deref_data(begin(m)) << std::endl;
std::cout << deref_data(fusion::next(begin(m))) << std::endl;
@ -71,10 +71,10 @@ main()
BOOST_TEST(deref_data(begin(m)) == 'X');
BOOST_TEST(deref_data(fusion::next(begin(m))) == "Men");
BOOST_STATIC_ASSERT((boost::is_same<result_of::key_of<result_of::begin<map_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<result_of::key_of<result_of::next<result_of::begin<map_type>::type>::type>::type, double>::value));
BOOST_STATIC_ASSERT((boost::is_same<result_of::value_of_data<result_of::begin<map_type>::type>::type, char>::value));
BOOST_STATIC_ASSERT((boost::is_same<result_of::value_of_data<result_of::next<result_of::begin<map_type>::type>::type>::type, std::string>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<map_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<map_type>::type>::type>::type, double>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<map_type>::type>::type, char>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<map_type>::type>::type>::type, std::string>::value));
}
{

View File

@ -21,7 +21,7 @@
#endif
#if !defined(FUSION_SIZE)
#define FUSION_SIZE result_of::size
#define FUSION_SIZE boost::fusion::result_of::size
#endif
template <typename S1, typename S2>
@ -144,8 +144,8 @@ test()
BOOST_STATIC_ASSERT(FUSION_SIZE<t1>::value == 3);
BOOST_STATIC_ASSERT(FUSION_SIZE<t2>::value == 0);
BOOST_STATIC_ASSERT(!result_of::empty<t1>::value);
BOOST_STATIC_ASSERT(result_of::empty<t2>::value);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<t1>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::empty<t2>::value);
}
{ // testing front & back

View File

@ -54,9 +54,9 @@ main()
std::cout << rev << std::endl;
BOOST_TEST((rev == make_vector(s, 123456789, 'x', 123)));
typedef result_of::begin<view_type>::type first_type;
typedef boost::fusion::result_of::begin<view_type>::type first_type;
first_type first_it(begin(rev));
typedef result_of::next<first_type>::type second_type;
typedef boost::fusion::result_of::next<first_type>::type second_type;
second_type second_it(next(first_it));
BOOST_TEST((*second_it == 123456789));
BOOST_TEST((*prior(second_it) == s));
@ -69,16 +69,16 @@ main()
BOOST_TEST((at_c<3>(rev)==123));
BOOST_MPL_ASSERT((
boost::is_same<result_of::value_at_c<view_type,0>::type,char const*>
boost::is_same<boost::fusion::result_of::value_at_c<view_type,0>::type,char const*>
));
BOOST_MPL_ASSERT((
boost::is_same<result_of::value_at_c<view_type,1>::type,long>
boost::is_same<boost::fusion::result_of::value_at_c<view_type,1>::type,long>
));
BOOST_MPL_ASSERT((
boost::is_same<result_of::value_at_c<view_type,2>::type,char>
boost::is_same<boost::fusion::result_of::value_at_c<view_type,2>::type,char>
));
BOOST_MPL_ASSERT((
boost::is_same<result_of::value_at_c<view_type,3>::type,int>
boost::is_same<boost::fusion::result_of::value_at_c<view_type,3>::type,int>
));
}

View File

@ -12,7 +12,6 @@
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/view/iterator_range/iterator_range.hpp>
#include <boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp>
#include <boost/fusion/sequence/comparison/equal_to.hpp>
#include <boost/fusion/sequence/io/out.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
@ -44,8 +43,8 @@ process_tree(Tree const &tree)
using namespace fusion;
using mpl::_;
typedef typename fusion::result_of::find_if_s<Tree const, is_same<_,short> >::type short_iter;
typedef typename 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<_,short> >::type short_iter;
typedef typename boost::fusion::result_of::find_if_s<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);
@ -89,7 +88,7 @@ main()
slice_t slice(i1, i3);
std::cout << slice << std::endl;
BOOST_TEST((slice == make_vector('x', 3.3)));
BOOST_STATIC_ASSERT(result_of::size<slice_t>::value == 2);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 2);
}
{
@ -103,7 +102,7 @@ main()
slice_t slice(i1, i3);
std::cout << slice << std::endl;
BOOST_TEST(slice == make_vector());
BOOST_STATIC_ASSERT(result_of::size<slice_t>::value == 0);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 0);
}
}
@ -121,7 +120,7 @@ main()
slice_t slice(f, l);
std::cout << slice << std::endl;
BOOST_TEST((slice == make_vector(3, 4)));
BOOST_STATIC_ASSERT(result_of::size<slice_t>::value == 2);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<slice_t>::value == 2);
}
{

View File

@ -50,15 +50,15 @@ main()
BOOST_TEST(at_key<std::string>(m) == "Hola");
BOOST_STATIC_ASSERT((
boost::is_same<result_of::value_at_key<set_type, int>::type, int>::value));
boost::is_same<boost::fusion::result_of::value_at_key<set_type, int>::type, int>::value));
BOOST_STATIC_ASSERT((
boost::is_same<result_of::value_at_key<set_type, std::string>::type, std::string>::value));
boost::is_same<boost::fusion::result_of::value_at_key<set_type, std::string>::type, std::string>::value));
std::cout << m << std::endl;
BOOST_STATIC_ASSERT((result_of::has_key<set_type, int>::value));
BOOST_STATIC_ASSERT((result_of::has_key<set_type, std::string>::value));
BOOST_STATIC_ASSERT((!result_of::has_key<set_type, double>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<set_type, int>::value));
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<set_type, std::string>::value));
BOOST_STATIC_ASSERT((!boost::fusion::result_of::has_key<set_type, double>::value));
std::cout << deref_data(begin(m)) << std::endl;
std::cout << deref_data(fusion::next(begin(m))) << std::endl;
@ -66,10 +66,10 @@ main()
BOOST_TEST(deref_data(begin(m)) == 123);
BOOST_TEST(deref_data(fusion::next(begin(m))) == "Hola");
BOOST_STATIC_ASSERT((boost::is_same<result_of::key_of<result_of::begin<set_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<result_of::key_of<result_of::next<result_of::begin<set_type>::type>::type>::type, std::string>::value));
BOOST_STATIC_ASSERT((boost::is_same<result_of::value_of_data<result_of::begin<set_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<result_of::value_of_data<result_of::next<result_of::begin<set_type>::type>::type>::type, std::string>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::begin<set_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<set_type>::type>::type>::type, std::string>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<set_type>::type>::type, int>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<set_type>::type>::type>::type, std::string>::value));
}
{

View File

@ -76,7 +76,7 @@ main()
BOOST_TEST(end(view1) == advance_c<0>(end(view1)));
BOOST_TEST(begin(view1) == advance_c<-1>(end(view1)));
BOOST_TEST(1 == size(view1));
BOOST_MPL_ASSERT((boost::is_same<int, result_of::value_at<single_view<int>, boost::mpl::int_<0> >::type>));
BOOST_MPL_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at<single_view<int>, boost::mpl::int_<0> >::type>));
single_view<X> view2;
std::cout << view2 << std::endl;

View File

@ -55,8 +55,8 @@ main()
at_c<1>(p) = "mama mia";
BOOST_TEST(p == make_vector(6, "mama mia"));
BOOST_STATIC_ASSERT(result_of::size<pair_type>::value == 2);
BOOST_STATIC_ASSERT(!result_of::empty<pair_type>::value);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<pair_type>::value == 2);
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<pair_type>::value);
BOOST_TEST(front(p) == 6);
BOOST_TEST(back(p) == "mama mia");

View File

@ -22,7 +22,7 @@ int main()
namespace fusion = boost::fusion;
{
typedef fusion::vector<std::vector<int>, char> test_vector;
BOOST_MPL_ASSERT((boost::is_same<void, fusion::result_of::swap<test_vector, test_vector>::type>));
BOOST_MPL_ASSERT((boost::is_same<void, boost::fusion::result_of::swap<test_vector, test_vector>::type>));
test_vector v1(std::vector<int>(1, 101), 'a'), v2(std::vector<int>(1, 202), 'b');

View File

@ -19,18 +19,14 @@
#include <boost/fusion/container/vector/vector10.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/sequence/intrinsic/segments.hpp>
#include <boost/fusion/sequence/intrinsic/detail/segmented_size.hpp>
#include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/iterator/segmented_iterator.hpp>
#include <boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp>
#include <boost/fusion/sequence/intrinsic/detail/segmented_end.hpp>
#include <boost/fusion/sequence/intrinsic/segments.hpp>
namespace boost { namespace fusion
{
struct tree_tag;
template<typename Data, typename Left = nil, typename Right = nil>
template <typename Data, typename Left = nil, typename Right = nil>
struct tree
: sequence_base<tree<Data, Left, Right> >
{
@ -38,7 +34,7 @@ namespace boost { namespace fusion
typedef Left left_type;
typedef Right right_type;
typedef tree_tag fusion_tag;
typedef bidirectional_traversal_tag category;
typedef forward_traversal_tag category;
typedef mpl::false_ is_view;
typedef typename mpl::if_<
@ -59,13 +55,13 @@ namespace boost { namespace fusion
segments_type segments;
};
template<typename Data>
template <typename Data>
tree<Data> make_tree(Data const &data)
{
return tree<Data>(data);
}
template<typename Data, typename Left, typename Right>
template <typename Data, typename Left, typename Right>
tree<Data, Left, Right> make_tree(Data const &data, Left const &left, Right const &right)
{
return tree<Data, Left, Right>(data, left, right);
@ -73,17 +69,17 @@ namespace boost { namespace fusion
namespace extension
{
template<>
template <>
struct is_segmented_impl<tree_tag>
{
template<typename Sequence>
template <typename Sequence>
struct apply : mpl::true_ {};
};
template<>
template <>
struct segments_impl<tree_tag>
{
template<typename Sequence>
template <typename Sequence>
struct apply
{
typedef typename mpl::if_<
@ -98,33 +94,6 @@ namespace boost { namespace fusion
}
};
};
template<>
struct begin_impl<tree_tag>
{
template<typename Sequence>
struct apply
: segmented_begin<Sequence>
{};
};
template<>
struct end_impl<tree_tag>
{
template<typename Sequence>
struct apply
: segmented_end<Sequence>
{};
};
template<>
struct size_impl<tree_tag>
{
template<typename Sequence>
struct apply
: segmented_size<Sequence>::type
{};
};
}
}}

View File

@ -16,7 +16,7 @@
#endif
#if !defined(FUSION_VALUE_AT)
#define FUSION_VALUE_AT(S, N) result_of::value_at_c<S, N>
#define FUSION_VALUE_AT(S, N) boost::fusion::result_of::value_at_c<S, N>
#endif
namespace test_detail

View File

@ -41,10 +41,10 @@ main()
{
typedef vector1<int> type;
type vec;
BOOST_STATIC_ASSERT(result_of::size<type>::value == 1);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<type>::value == 1);
BOOST_TEST(at_c<0>(vec) == 0);
BOOST_STATIC_ASSERT((boost::is_same<int, result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at_c<type, 0>::type>::value));
// prove that it is mutable
at_c<0>(vec) = 987;
@ -76,13 +76,13 @@ main()
{
typedef vector2<int, char> type;
type vec;
BOOST_STATIC_ASSERT(result_of::size<type>::value == 2);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<type>::value == 2);
BOOST_TEST(at_c<0>(vec) == 0);
BOOST_TEST(at_c<1>(vec) == char());
BOOST_STATIC_ASSERT((boost::is_same<int, result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<char, result_of::value_at_c<type, 1>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<char, boost::fusion::result_of::value_at_c<type, 1>::type>::value));
}
{
@ -102,15 +102,15 @@ main()
{
typedef vector3<int, char, double> type;
type vec;
BOOST_STATIC_ASSERT(result_of::size<type>::value == 3);
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<type>::value == 3);
BOOST_TEST(at_c<0>(vec) == 0);
BOOST_TEST(at_c<1>(vec) == char());
BOOST_TEST(at_c<2>(vec) == double());
BOOST_STATIC_ASSERT((boost::is_same<int, result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<char, result_of::value_at_c<type, 1>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<double, result_of::value_at_c<type, 2>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<char, boost::fusion::result_of::value_at_c<type, 1>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<double, boost::fusion::result_of::value_at_c<type, 2>::type>::value));
}
{
@ -146,13 +146,13 @@ main()
BOOST_TEST(at_c<5>(vec) >= 5.9 && at_c<5>(vec) <= 6.1);
BOOST_TEST(at_c<6>(vec) >= 6.9 && at_c<6>(vec) <= 7.1);
BOOST_STATIC_ASSERT((boost::is_same<bool, result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<char, result_of::value_at_c<type, 1>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<short, result_of::value_at_c<type, 2>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<int, result_of::value_at_c<type, 3>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<long, result_of::value_at_c<type, 4>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<float, result_of::value_at_c<type, 5>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<double, result_of::value_at_c<type, 6>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<bool, boost::fusion::result_of::value_at_c<type, 0>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<char, boost::fusion::result_of::value_at_c<type, 1>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<short, boost::fusion::result_of::value_at_c<type, 2>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<int, boost::fusion::result_of::value_at_c<type, 3>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<long, boost::fusion::result_of::value_at_c<type, 4>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<float, boost::fusion::result_of::value_at_c<type, 5>::type>::value));
BOOST_STATIC_ASSERT((boost::is_same<double, boost::fusion::result_of::value_at_c<type, 6>::type>::value));
std::cout << "(bool, char, short, int, long, float, double): " << sizeof(vec) << std::endl;
}

View File

@ -34,19 +34,19 @@ int main()
BOOST_TEST(at_c<0>(back(v)) == 2);
BOOST_TEST(at_c<2>(back(v)) == 'b');
typedef result_of::begin<view>::type first_iterator;
typedef result_of::value_of<first_iterator>::type first_element;
typedef boost::fusion::result_of::begin<view>::type first_iterator;
typedef boost::fusion::result_of::value_of<first_iterator>::type first_element;
typedef result_of::at_c<first_element, 0>::type e0;
typedef result_of::at_c<first_element, 2>::type e2;
typedef boost::fusion::result_of::at_c<first_element, 0>::type e0;
typedef boost::fusion::result_of::at_c<first_element, 2>::type e2;
BOOST_MPL_ASSERT((boost::is_same<e0, int&>));
BOOST_MPL_ASSERT((boost::is_same<e2, char&>));
BOOST_TEST(size(front(v)) == 3);
typedef result_of::value_at_c<view, 0>::type first_value_at;
typedef result_of::value_at_c<first_value_at, 0>::type v0;
typedef result_of::value_at_c<first_value_at, 2>::type v2;
typedef boost::fusion::result_of::value_at_c<view, 0>::type first_value_at;
typedef boost::fusion::result_of::value_at_c<first_value_at, 0>::type v0;
typedef boost::fusion::result_of::value_at_c<first_value_at, 2>::type v2;
BOOST_MPL_ASSERT((boost::is_same<v0, int>));
BOOST_MPL_ASSERT((boost::is_same<v2, char>));