From 15dd9c9d976190f1e61007d93fb78a3af4946597 Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Wed, 12 Nov 2014 11:13:06 +0800 Subject: [PATCH] test that adapted members can actually be expressions --- test/sequence/adapt_struct.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/sequence/adapt_struct.cpp b/test/sequence/adapt_struct.cpp index 68240463..e64507cf 100644 --- a/test/sequence/adapt_struct.cpp +++ b/test/sequence/adapt_struct.cpp @@ -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 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(); }