mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-23 00:57:20 +02:00
Merge remote-tracking branch 'official/develop' into fusion_adapters
Conflicts: test/sequence/adapt_struct.cpp
This commit is contained in:
@ -56,6 +56,17 @@ namespace ns
|
||||
{}
|
||||
};
|
||||
#endif
|
||||
|
||||
struct foo
|
||||
{
|
||||
int x;
|
||||
};
|
||||
|
||||
struct bar
|
||||
{
|
||||
foo foo_;
|
||||
int y;
|
||||
};
|
||||
}
|
||||
|
||||
#if BOOST_PP_VARIADICS
|
||||
@ -79,6 +90,12 @@ namespace ns
|
||||
struct s { int m; };
|
||||
BOOST_FUSION_ADAPT_STRUCT(s, m)
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
ns::bar,
|
||||
foo_.x, // test that adapted members can actually be expressions
|
||||
y
|
||||
)
|
||||
|
||||
#else // BOOST_PP_VARIADICS
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
@ -100,6 +117,12 @@ namespace ns
|
||||
struct s { int m; };
|
||||
BOOST_FUSION_ADAPT_STRUCT(s, (BOOST_FUSION_ADAPT_AUTO, m))
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
ns::bar,
|
||||
(BOOST_FUSION_ADAPT_AUTO, foo_.x) // test that adapted members can actually be expressions
|
||||
(BOOST_FUSION_ADAPT_AUTO, y)
|
||||
)
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
@ -192,6 +215,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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user