mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-16 05:42:20 +02:00
test that adapted members can actually be expressions
This commit is contained in:
@ -54,6 +54,17 @@ namespace ns
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct foo
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct bar
|
||||||
|
{
|
||||||
|
foo foo_;
|
||||||
|
int y;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FUSION_ADAPT_STRUCT(
|
BOOST_FUSION_ADAPT_STRUCT(
|
||||||
@ -73,6 +84,12 @@ BOOST_FUSION_ADAPT_STRUCT(
|
|||||||
struct s { int m; };
|
struct s { int m; };
|
||||||
BOOST_FUSION_ADAPT_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
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
@ -159,6 +176,15 @@ main()
|
|||||||
}
|
}
|
||||||
#endif
|
#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();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user