From ce3f2d6020ba490805e0fd030b640e8bf94924b5 Mon Sep 17 00:00:00 2001 From: "Damien Buhl (alias daminetreg)" Date: Wed, 11 Jun 2014 00:27:22 +0200 Subject: [PATCH] Added new ADAPT_STRUCT API support for the ADAPT_STRUCT_AS_VIEW macro. --- .../fusion/adapted/struct/adapt_struct.hpp | 31 +++++++++++++------ .../adapted/struct/detail/adapt_base.hpp | 1 - 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/include/boost/fusion/adapted/struct/adapt_struct.hpp b/include/boost/fusion/adapted/struct/adapt_struct.hpp index 58c4c4d6..6a70419c 100644 --- a/include/boost/fusion/adapted/struct/adapt_struct.hpp +++ b/include/boost/fusion/adapted/struct/adapt_struct.hpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -65,6 +66,15 @@ 0, \ BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER(__VA_ARGS__), \ BOOST_FUSION_ADAPT_STRUCT_C) + +# define BOOST_FUSION_ADAPT_STRUCT_AS_VIEW(NAME, ...) \ + BOOST_FUSION_ADAPT_STRUCT_BASE( \ + (0), \ + (0)(NAME), \ + struct_tag, \ + 1, \ + BOOST_FUSION_ADAPT_STRUCT_ATTRIBUTES_FILLER(__VA_ARGS__), \ + BOOST_FUSION_ADAPT_STRUCT_C) #else // BOOST_PP_VARIADICS @@ -79,15 +89,18 @@ _END), \ BOOST_FUSION_ADAPT_STRUCT_C) +# define BOOST_FUSION_ADAPT_STRUCT_AS_VIEW(NAME, ATTRIBUTES) \ + BOOST_FUSION_ADAPT_STRUCT_BASE( \ + (0), \ + (0)(NAME), \ + struct_tag, \ + 1, \ + BOOST_PP_CAT( \ + BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES, \ + _END), \ + BOOST_FUSION_ADAPT_STRUCT_C) + + #endif // BOOST_PP_VARIADICS -#define BOOST_FUSION_ADAPT_STRUCT_AS_VIEW(NAME, ATTRIBUTES) \ - BOOST_FUSION_ADAPT_STRUCT_BASE( \ - (0), \ - (0)(NAME), \ - struct_tag, \ - 1, \ - BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \ - BOOST_FUSION_ADAPT_STRUCT_C) - #endif diff --git a/include/boost/fusion/adapted/struct/detail/adapt_base.hpp b/include/boost/fusion/adapted/struct/detail/adapt_base.hpp index 90bac86c..3dafd0cb 100644 --- a/include/boost/fusion/adapted/struct/detail/adapt_base.hpp +++ b/include/boost/fusion/adapted/struct/detail/adapt_base.hpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include