merge [70965] [73644] [73668] [73669] [73683] [73770] [73771] [73831] [73834] [73854] [73892] [73898] [73899] [73906] [73908] [73927] [74019] [74048] [74113] from trunk to release

[SVN r74325]
This commit is contained in:
Eric Niebler
2011-09-09 03:27:28 +00:00
139 changed files with 3858 additions and 2176 deletions

View File

@@ -41,6 +41,10 @@ import testing ;
[ run algorithm/reverse_fold.cpp : : : : ]
[ run algorithm/reverse_iter_fold.cpp : : : : ]
[ run algorithm/reverse.cpp : : : : ]
[ run algorithm/segmented_for_each.cpp : : : : ]
[ run algorithm/segmented_find.cpp : : : : ]
[ run algorithm/segmented_find_if.cpp : : : : ]
[ run algorithm/segmented_fold.cpp : : : : ]
[ run algorithm/transform.cpp : : : : ]
[ run algorithm/join.cpp : : : : ]
[ run algorithm/zip.cpp : : : : ]
@@ -83,6 +87,7 @@ import testing ;
[ run sequence/map_tie.cpp : : : : ]
[ run sequence/nview.cpp : : : : ]
[ run sequence/reverse_view.cpp : : : : ]
[ run sequence/segmented_iterator_range.cpp : : : : ]
[ run sequence/set.cpp : : : : ]
[ run sequence/single_view.cpp : : : : ]
[ run sequence/std_pair.cpp : : : : ]
@@ -149,17 +154,3 @@ import testing ;
;
}
{
# Text for extension features, must be explicitly specified on the command line to be run
# TODO these are not in a test-suite because currently test-suites cannot be marked "explicit"
run algorithm/ext_/for_each_s.cpp ;
explicit for_each_s ;
run algorithm/ext_/find_if_s.cpp ;
explicit find_if_s ;
run sequence/ext_/iterator_range_s.cpp ;
explicit iterator_range_s ;
}

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

@@ -1,109 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/adapted/mpl.hpp>
#include <boost/fusion/sequence/io/out.hpp>
#include <boost/fusion/algorithm/query/ext_/find_if_s.hpp>
#include <boost/fusion/container/ext_/tree.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/vector_c.hpp>
#include <boost/mpl/less.hpp>
#include <boost/type_traits/is_same.hpp>
struct X
{
operator int() const
{
return 12345;
}
};
template<typename Tree>
void
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;
// find_if_s of a segmented data structure returns generic
// segmented iterators
short_iter si = fusion::find_if_s<is_same<_,short> >(tree);
float_iter fi = fusion::find_if_s<is_same<_,float> >(tree);
// they behave like ordinary Fusion iterators ...
BOOST_TEST((*si == short('d')));
BOOST_TEST((*fi == float(1)));
}
int
main()
{
using namespace boost::fusion;
{
using boost::is_same;
using boost::mpl::_;
typedef vector<int, char, int, double> vector_type;
vector_type v(12345, 'x', 678910, 3.36);
std::cout << *find_if_s<is_same<_, char> >(v) << std::endl;
BOOST_TEST((*find_if_s<is_same<_, char> >(v) == 'x'));
std::cout << *find_if_s<is_same<_, int> >(v) << std::endl;
BOOST_TEST((*find_if_s<is_same<_, int> >(v) == 12345));
std::cout << *find_if_s<is_same<_, double> >(v) << std::endl;
BOOST_TEST((*find_if_s<is_same<_, double> >(v) == 3.36));
}
{
using boost::mpl::vector;
using boost::is_same;
using boost::mpl::_;
typedef vector<int, char, X, double> mpl_vec;
BOOST_TEST((*find_if_s<is_same<_, X> >(mpl_vec()) == 12345));
}
{
using boost::mpl::vector_c;
using boost::mpl::less;
using boost::mpl::int_;
using boost::is_same;
using boost::mpl::_;
typedef vector_c<int, 1, 2, 3, 4> mpl_vec;
BOOST_TEST((*find_if_s<less<_, int_<3> > >(mpl_vec()) == 1));
}
{
process_tree(
make_tree(
make_vector(double(0),'B')
, make_tree(
make_vector(1,2,long(3))
, make_tree(make_vector('a','b','c'))
, make_tree(make_vector(short('d'),'e','f'))
)
, make_tree(
make_vector(4,5,6)
, make_tree(make_vector(float(1),'h','i'))
, make_tree(make_vector('j','k','l'))
)
)
);
}
return boost::report_errors();
}

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

@@ -0,0 +1,62 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2011 Eric Niebler
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/algorithm/query/find.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include "../sequence/tree.hpp"
struct not_there {};
template<typename Tree>
void
process_tree(Tree const &tree)
{
using namespace boost;
typedef typename boost::fusion::result_of::find<Tree const, short>::type short_iter;
typedef typename boost::fusion::result_of::find<Tree const, float>::type float_iter;
typedef typename boost::fusion::result_of::find<Tree const, not_there>::type not_there_iter;
// find_if_s of a segmented data structure returns generic
// segmented iterators
short_iter si = fusion::find<short>(tree);
float_iter fi = fusion::find<float>(tree);
// they behave like ordinary Fusion iterators ...
BOOST_TEST((*si == short('d')));
BOOST_TEST((*fi == float(1)));
// Searching for something that's not there should return the end iterator.
not_there_iter nti = fusion::find<not_there>(tree);
BOOST_TEST((nti == fusion::end(tree)));
}
int
main()
{
using namespace boost::fusion;
process_tree(
make_tree(
make_vector(double(0),'B')
, make_tree(
make_vector(1,2,long(3))
, make_tree(make_vector('a','b','c'))
, make_tree(make_vector(short('d'),'e','f'))
)
, make_tree(
make_vector(4,5,6)
, make_tree(make_vector(float(1),'h','i'))
, make_tree(make_vector('j','k','l'))
)
)
);
return boost::report_errors();
}

View File

@@ -0,0 +1,65 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2011 Eric Niebler
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/algorithm/query/find_if.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/type_traits/is_same.hpp>
#include "../sequence/tree.hpp"
struct not_there {};
template<typename Tree>
void
process_tree(Tree const &tree)
{
using namespace boost;
using mpl::_;
typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,short> >::type short_iter;
typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,float> >::type float_iter;
typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,not_there> >::type not_there_iter;
// find_if of a segmented data structure returns generic
// segmented iterators
short_iter si = fusion::find_if<is_same<_,short> >(tree);
float_iter fi = fusion::find_if<is_same<_,float> >(tree);
// they behave like ordinary Fusion iterators ...
BOOST_TEST((*si == short('d')));
BOOST_TEST((*fi == float(1)));
// Searching for something that's not there should return the end iterator.
not_there_iter nti = fusion::find_if<is_same<_,not_there> >(tree);
BOOST_TEST((nti == fusion::end(tree)));
}
int
main()
{
using namespace boost::fusion;
process_tree(
make_tree(
make_vector(double(0),'B')
, make_tree(
make_vector(1,2,long(3))
, make_tree(make_vector('a','b','c'))
, make_tree(make_vector(short('d'),'e','f'))
)
, make_tree(
make_vector(4,5,6)
, make_tree(make_vector(float(1),'h','i'))
, make_tree(make_vector('j','k','l'))
)
)
);
return boost::report_errors();
}

View File

@@ -0,0 +1,63 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2011 Eric Niebler
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#include <string>
#include <sstream>
#include <iostream>
#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/algorithm/iteration/fold.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include "../sequence/tree.hpp"
struct write_string
{
typedef std::ostream* result_type;
template<typename T>
std::ostream* operator()(std::ostream* sout, T const& t) const
{
return &(*sout << t << " ");
}
};
template<typename Tree>
void
process_tree(Tree const &tree)
{
using namespace boost;
std::stringstream str;
fusion::fold(tree, &str, write_string());
std::string res = str.str();
BOOST_TEST_EQ(res, "a b c 1 2 3 100 e f 0 B 1 h i 4 5 6 j k l ");
}
int
main()
{
using namespace boost::fusion;
process_tree(
make_tree(
make_vector(double(0),'B')
, make_tree(
make_vector(1,2,long(3))
, make_tree(make_vector('a','b','c'))
, make_tree(make_vector(short('d'),'e','f'))
)
, make_tree(
make_vector(4,5,6)
, make_tree(make_vector(float(1),'h','i'))
, make_tree(make_vector('j','k','l'))
)
)
);
return boost::report_errors();
}

View File

@@ -1,17 +1,15 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman, Eric Niebler
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2011 Eric Niebler
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/adapted/mpl.hpp>
#include <boost/fusion/sequence/io/out.hpp>
#include <boost/fusion/algorithm/iteration/ext_/for_each_s.hpp>
#include <boost/mpl/vector_c.hpp>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/container/ext_/tree.hpp>
#include "../sequence/tree.hpp"
struct print
{
@@ -22,44 +20,13 @@ struct print
}
};
struct increment
{
template <typename T>
void operator()(T& v) const
{
++v;
}
};
int
main()
{
using namespace boost::fusion;
using boost::mpl::vector_c;
namespace fusion = boost::fusion;
{
typedef vector<int, char, double, char const*> vector_type;
vector_type v(1, 'x', 3.3, "Ruby");
for_each_s(v, print());
std::cout << std::endl;
}
{
typedef vector<int, char, double, char const*> vector_type;
vector_type v(1, 'x', 3.3, "Ruby");
for_each_s(v, increment());
std::cout << v << std::endl;
}
{
typedef vector_c<int, 2, 3, 4, 5, 6> mpl_vec;
fusion::for_each_s(mpl_vec(), print());
std::cout << std::endl;
}
{
fusion::for_each_s(
for_each(
make_tree(
make_vector(double(0),'B')
, make_tree(

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

@@ -92,7 +92,6 @@ main()
{
using namespace boost::fusion;
using namespace boost;
using namespace std;
std::cout << tuple_open('[');
std::cout << tuple_close(']');
@@ -111,8 +110,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);
@@ -149,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>));
}
@@ -167,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);
@@ -178,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

@@ -84,8 +84,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);
@@ -128,7 +128,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

@@ -74,8 +74,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);
@@ -118,12 +118,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

@@ -76,8 +76,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);
@@ -123,12 +123,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

@@ -80,8 +80,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((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};
@@ -133,7 +133,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

@@ -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);
@@ -122,12 +122,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

@@ -97,8 +97,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);
@@ -136,16 +136,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

@@ -76,8 +76,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);
@@ -119,17 +119,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

@@ -86,8 +86,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

@@ -57,8 +57,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

@@ -56,15 +56,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;
@@ -72,10 +72,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

@@ -1,17 +1,17 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2011 Eric Niebler
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#include <sstream>
#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/algorithm/iteration/ext_/for_each_s.hpp>
#include <boost/fusion/algorithm/query/ext_/find_if_s.hpp>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
#include <boost/fusion/algorithm/query/find_if.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/container/ext_/tree.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/view/iterator_range/iterator_range.hpp>
#include <boost/fusion/view/ext_/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>
@@ -19,7 +19,7 @@
#include <boost/mpl/begin.hpp>
#include <boost/mpl/next.hpp>
#include <boost/static_assert.hpp>
#include <sstream>
#include "tree.hpp"
struct ostream_fun
{
@@ -43,23 +43,23 @@ 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<Tree const, is_same<_,short> >::type short_iter;
typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,float> >::type float_iter;
typedef iterator_range<short_iter, float_iter> slice_t;
BOOST_STATIC_ASSERT(traits::is_segmented<slice_t>::value);
// find_if_s of a segmented data structure returns generic
// find_if of a segmented data structure returns generic
// segmented iterators
short_iter si = find_if_s<is_same<_,short> >(tree);
float_iter fi = find_if_s<is_same<_,float> >(tree);
short_iter si = find_if<is_same<_,short> >(tree);
float_iter fi = find_if<is_same<_,float> >(tree);
// If you put them in an iterator range, the range
// is automatically a segmented data structure.
slice_t slice(si, fi);
std::stringstream sout;
fusion::for_each_s(slice, ostream_fun(sout));
fusion::for_each(slice, ostream_fun(sout));
BOOST_TEST((sout.str() == "100 e f 0 B "));
}
@@ -88,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);
}
{
@@ -102,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);
}
}
@@ -120,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

@@ -51,15 +51,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;
@@ -67,10 +67,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

@@ -56,8 +56,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');

100
test/sequence/tree.hpp Normal file
View File

@@ -0,0 +1,100 @@
/*=============================================================================
Copyright (c) 2006 Eric Niebler
Use, modification and distribution is subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef FUSION_BINARY_TREE_EAN_05032006_1027
#define FUSION_BINARY_TREE_EAN_05032006_1027
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/fusion/view/single_view.hpp>
#include <boost/fusion/container/list/cons.hpp> // for nil
#include <boost/fusion/container/vector/vector10.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/sequence/intrinsic/segments.hpp>
namespace boost { namespace fusion
{
struct tree_tag;
template <typename Data, typename Left = nil, typename Right = nil>
struct tree
: sequence_base<tree<Data, Left, Right> >
{
typedef Data data_type;
typedef Left left_type;
typedef Right right_type;
typedef tree_tag fusion_tag;
typedef forward_traversal_tag category;
typedef mpl::false_ is_view;
typedef typename mpl::if_<
traits::is_sequence<Data>
, Data
, single_view<Data>
>::type data_view;
explicit tree(
typename fusion::detail::call_param<Data>::type data_
, typename fusion::detail::call_param<Left>::type left_ = Left()
, typename fusion::detail::call_param<Right>::type right_ = Right()
)
: segments(left_, data_view(data_), right_)
{}
typedef vector3<Left, data_view, Right> segments_type;
segments_type segments;
};
template <typename Data>
tree<Data> make_tree(Data const &data)
{
return tree<Data>(data);
}
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);
}
namespace extension
{
template <>
struct is_segmented_impl<tree_tag>
{
template <typename Sequence>
struct apply : mpl::true_ {};
};
template <>
struct segments_impl<tree_tag>
{
template <typename Sequence>
struct apply
{
typedef typename mpl::if_<
is_const<Sequence>
, typename Sequence::segments_type const &
, typename Sequence::segments_type &
>::type type;
static type call(Sequence &seq)
{
return seq.segments;
}
};
};
}
}}
#endif

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

@@ -42,10 +42,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;
@@ -77,13 +77,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));
}
{
@@ -103,15 +103,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));
}
{
@@ -147,13 +147,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));
cout << "(bool, char, short, int, long, float, double): " << sizeof(vec) << 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>));