test that adapted members can actually be expressions

This commit is contained in:
Joel de Guzman
2014-11-12 11:13:06 +08:00
parent 1dccb553ea
commit 15dd9c9d97

View File

@ -54,6 +54,17 @@ namespace ns
{}
};
#endif
struct foo
{
int x;
};
struct bar
{
foo foo_;
int y;
};
}
BOOST_FUSION_ADAPT_STRUCT(
@ -73,6 +84,12 @@ BOOST_FUSION_ADAPT_STRUCT(
struct s { int m; };
BOOST_FUSION_ADAPT_STRUCT(s, (int, m))
BOOST_FUSION_ADAPT_STRUCT(
ns::bar,
(int, foo_.x) // test that adapted members can actually be expressions
(int, y)
)
int
main()
{
@ -159,6 +176,15 @@ main()
}
#endif
{
fusion::vector<int, float> v1(4, 2);
ns::bar v2 = {5, 3};
BOOST_TEST(v1 < v2);
BOOST_TEST(v1 <= v2);
BOOST_TEST(v2 > v1);
BOOST_TEST(v2 >= v1);
}
return boost::report_errors();
}