mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-23 09:07:26 +02:00
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:
@ -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
|
||||
>));
|
||||
}
|
||||
|
@ -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>));
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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>));
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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};
|
||||
|
||||
|
@ -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>));
|
||||
}
|
||||
|
||||
|
@ -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>));
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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((
|
||||
|
@ -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');
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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>));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -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>));
|
||||
}
|
||||
|
||||
|
||||
|
@ -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"));
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
));
|
||||
}
|
||||
|
||||
|
28
test/sequence/ext_/iterator_range_s.cpp → test/sequence/segmented_iterator_range.cpp
Executable file → Normal file
28
test/sequence/ext_/iterator_range_s.cpp → test/sequence/segmented_iterator_range.cpp
Executable file → Normal 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);
|
||||
}
|
||||
|
||||
{
|
@ -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));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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
100
test/sequence/tree.hpp
Normal 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
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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>));
|
||||
|
Reference in New Issue
Block a user