Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68303 - in trunk/boost/fusion/adapted: adt struct struct/detail
From: mr.chr.schmidt_at_[hidden]
Date: 2011-01-19 12:46:08


Author: cschmidt
Date: 2011-01-19 12:46:05 EST (Wed, 19 Jan 2011)
New Revision: 68303
URL: http://svn.boost.org/trac/boost/changeset/68303

Log:
Fusion: adapt-macros: allow empty boost.pp sequences; refs #5093
Text files modified:
   trunk/boost/fusion/adapted/adt/adapt_adt.hpp | 8 ++--
   trunk/boost/fusion/adapted/adt/adapt_assoc_adt.hpp | 11 +++--
   trunk/boost/fusion/adapted/struct/adapt_assoc_struct.hpp | 11 +++--
   trunk/boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp | 5 +-
   trunk/boost/fusion/adapted/struct/adapt_struct.hpp | 9 ++--
   trunk/boost/fusion/adapted/struct/adapt_struct_named.hpp | 5 +-
   trunk/boost/fusion/adapted/struct/define_assoc_struct.hpp | 8 ++-
   trunk/boost/fusion/adapted/struct/define_struct.hpp | 6 +-
   trunk/boost/fusion/adapted/struct/detail/adapt_base.hpp | 18 +++++---
   trunk/boost/fusion/adapted/struct/detail/define_struct.hpp | 79 +++++++++++++++++++++++++++++++--------
   10 files changed, 110 insertions(+), 50 deletions(-)

Modified: trunk/boost/fusion/adapted/adt/adapt_adt.hpp
==============================================================================
--- trunk/boost/fusion/adapted/adt/adapt_adt.hpp (original)
+++ trunk/boost/fusion/adapted/adt/adapt_adt.hpp 2011-01-19 12:46:05 EST (Wed, 19 Jan 2011)
@@ -1,7 +1,7 @@
 /*=============================================================================
     Copyright (c) 2001-2009 Joel de Guzman
     Copyright (c) 2009-2010 Hartmut Kaiser
- Copyright (c) 2010 Christopher Schmidt
+ Copyright (c) 2010-2011 Christopher Schmidt
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -49,7 +49,7 @@
         (1)NAME_SEQ, \
         struct_tag, \
         0, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_ADT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT(BOOST_FUSION_ADAPT_ADT_FILLER_0(0,0,0,0)ATTRIBUTES,_END), \
         BOOST_FUSION_ADAPT_ADT_C)
 
 #define BOOST_FUSION_ADAPT_ADT(NAME, ATTRIBUTES) \
@@ -58,7 +58,7 @@
         (0)(NAME), \
         struct_tag, \
         0, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_ADT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT(BOOST_FUSION_ADAPT_ADT_FILLER_0(0,0,0,0)ATTRIBUTES,_END), \
         BOOST_FUSION_ADAPT_ADT_C)
 
 #define BOOST_FUSION_ADAPT_ADT_AS_VIEW(NAME, ATTRIBUTES) \
@@ -67,7 +67,7 @@
         (0)(NAME), \
         struct_tag, \
         1, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_ADT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT(BOOST_FUSION_ADAPT_ADT_FILLER_0(0,0,0,0)ATTRIBUTES,_END), \
         BOOST_FUSION_ADAPT_ADT_C)
 
 #endif

Modified: trunk/boost/fusion/adapted/adt/adapt_assoc_adt.hpp
==============================================================================
--- trunk/boost/fusion/adapted/adt/adapt_assoc_adt.hpp (original)
+++ trunk/boost/fusion/adapted/adt/adapt_assoc_adt.hpp 2011-01-19 12:46:05 EST (Wed, 19 Jan 2011)
@@ -1,7 +1,7 @@
 /*=============================================================================
     Copyright (c) 2001-2009 Joel de Guzman
     Copyright (c) 2007 Dan Marsden
- Copyright (c) 2010 Christopher Schmidt
+ Copyright (c) 2010-2011 Christopher Schmidt
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -63,7 +63,8 @@
         (1)NAME_SEQ, \
         assoc_struct_tag, \
         0, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT( \
+ BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(0,0,0,0,0)ATTRIBUTES,_END), \
         BOOST_FUSION_ADAPT_ASSOC_ADT_C)
 
 #define BOOST_FUSION_ADAPT_ASSOC_ADT(NAME, ATTRIBUTES) \
@@ -72,7 +73,8 @@
         (0)(NAME), \
         assoc_struct_tag, \
         0, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT( \
+ BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(0,0,0,0,0)ATTRIBUTES,_END), \
         BOOST_FUSION_ADAPT_ASSOC_ADT_C)
 
 #define BOOST_FUSION_ADAPT_ASSOC_ADT_AS_VIEW(NAME, ATTRIBUTES) \
@@ -81,7 +83,8 @@
         (0)(NAME), \
         assoc_struct_tag, \
         1, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT( \
+ BOOST_FUSION_ADAPT_ASSOC_ADT_FILLER_0(0,0,0,0,0)ATTRIBUTES,_END), \
         BOOST_FUSION_ADAPT_ASSOC_ADT_C)
 
 #endif

Modified: trunk/boost/fusion/adapted/struct/adapt_assoc_struct.hpp
==============================================================================
--- trunk/boost/fusion/adapted/struct/adapt_assoc_struct.hpp (original)
+++ trunk/boost/fusion/adapted/struct/adapt_assoc_struct.hpp 2011-01-19 12:46:05 EST (Wed, 19 Jan 2011)
@@ -1,7 +1,7 @@
 /*=============================================================================
     Copyright (c) 2001-2007 Joel de Guzman
     Copyright (c) 2007 Dan Marsden
- Copyright (c) 2009-2010 Christopher Schmidt
+ Copyright (c) 2009-2011 Christopher Schmidt
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -69,7 +69,8 @@
         (1)NAME_SEQ, \
         assoc_struct_tag, \
         0, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT( \
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \
         BOOST_FUSION_ADAPT_ASSOC_STRUCT_C)
 
 #define BOOST_FUSION_ADAPT_ASSOC_STRUCT(NAME, ATTRIBUTES) \
@@ -78,7 +79,8 @@
         (0)(NAME), \
         assoc_struct_tag, \
         0, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT( \
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \
         BOOST_FUSION_ADAPT_ASSOC_STRUCT_C)
 
 #define BOOST_FUSION_ADAPT_ASSOC_STRUCT_AS_VIEW(NAME, ATTRIBUTES) \
@@ -87,7 +89,8 @@
         (0)(NAME), \
         assoc_struct_tag, \
         1, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT( \
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \
         BOOST_FUSION_ADAPT_ASSOC_STRUCT_C)
 
 #endif

Modified: trunk/boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp
==============================================================================
--- trunk/boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp (original)
+++ trunk/boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp 2011-01-19 12:46:05 EST (Wed, 19 Jan 2011)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2010 Christopher Schmidt
+ Copyright (c) 2010-2011 Christopher Schmidt
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -27,7 +27,8 @@
     BOOST_FUSION_ADAPT_ASSOC_STRUCT_AS_VIEW( \
         BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ)NAME, \
         BOOST_PP_CAT( \
- BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_FILLER_0 ATTRIBUTES,_END))
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_FILLER_0 ATTRIBUTES, \
+ _END))
 
 #define BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \
     BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_NS( \

Modified: trunk/boost/fusion/adapted/struct/adapt_struct.hpp
==============================================================================
--- trunk/boost/fusion/adapted/struct/adapt_struct.hpp (original)
+++ trunk/boost/fusion/adapted/struct/adapt_struct.hpp 2011-01-19 12:46:05 EST (Wed, 19 Jan 2011)
@@ -1,6 +1,6 @@
 /*=============================================================================
     Copyright (c) 2001-2007 Joel de Guzman
- Copyright (c) 2009-2010 Christopher Schmidt
+ Copyright (c) 2009-2011 Christopher Schmidt
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -46,7 +46,8 @@
         (1)NAME_SEQ, \
         struct_tag, \
         0, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END), \
+ ((0,0)) BOOST_PP_CAT( \
+ BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END), \
         BOOST_FUSION_ADAPT_STRUCT_C)
 
 #define BOOST_FUSION_ADAPT_STRUCT(NAME, ATTRIBUTES) \
@@ -55,7 +56,7 @@
         (0)(NAME), \
         struct_tag, \
         0, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
         BOOST_FUSION_ADAPT_STRUCT_C)
 
 #define BOOST_FUSION_ADAPT_STRUCT_AS_VIEW(NAME, ATTRIBUTES) \
@@ -64,7 +65,7 @@
         (0)(NAME), \
         struct_tag, \
         1, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
         BOOST_FUSION_ADAPT_STRUCT_C)
 
 #endif

Modified: trunk/boost/fusion/adapted/struct/adapt_struct_named.hpp
==============================================================================
--- trunk/boost/fusion/adapted/struct/adapt_struct_named.hpp (original)
+++ trunk/boost/fusion/adapted/struct/adapt_struct_named.hpp 2011-01-19 12:46:05 EST (Wed, 19 Jan 2011)
@@ -1,7 +1,7 @@
 /*=============================================================================
     Copyright (c) 2001-2007 Joel de Guzman
     Copyright (c) 2009-2010 Hartmut Kaiser
- Copyright (c) 2010 Christopher Schmidt
+ Copyright (c) 2010-2011 Christopher Schmidt
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -29,7 +29,8 @@
                                                                                 \
     BOOST_FUSION_ADAPT_STRUCT_AS_VIEW( \
         BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DECLARATION((0)NAMESPACE_SEQ)NAME, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_0 ATTRIBUTES,_END))
+ BOOST_PP_CAT( \
+ BOOST_FUSION_ADAPT_STRUCT_NAMED_FILLER_0 ATTRIBUTES,_END))
 
 #define BOOST_FUSION_ADAPT_STRUCT_NAMED(WRAPPED_TYPE, NAME, ATTRIBUTES) \
     BOOST_FUSION_ADAPT_STRUCT_NAMED_NS( \

Modified: trunk/boost/fusion/adapted/struct/define_assoc_struct.hpp
==============================================================================
--- trunk/boost/fusion/adapted/struct/define_assoc_struct.hpp (original)
+++ trunk/boost/fusion/adapted/struct/define_assoc_struct.hpp 2011-01-19 12:46:05 EST (Wed, 19 Jan 2011)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2010 Christopher Schmidt
+ Copyright (c) 2010-2011 Christopher Schmidt
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -18,7 +18,8 @@
         TEMPLATE_PARAMS_SEQ, \
         (0)NAMESPACE_SEQ, \
         NAME, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT( \
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \
         3) \
                                                                                 \
     BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT( \
@@ -31,7 +32,8 @@
     BOOST_FUSION_DEFINE_STRUCT_IMPL( \
         (0)NAMESPACE_SEQ, \
         NAME, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT( \
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0(0,0,0)ATTRIBUTES,_END), \
         3) \
                                                                                 \
     BOOST_FUSION_ADAPT_ASSOC_STRUCT( \

Modified: trunk/boost/fusion/adapted/struct/define_struct.hpp
==============================================================================
--- trunk/boost/fusion/adapted/struct/define_struct.hpp (original)
+++ trunk/boost/fusion/adapted/struct/define_struct.hpp 2011-01-19 12:46:05 EST (Wed, 19 Jan 2011)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2010 Christopher Schmidt
+ Copyright (c) 2010-2011 Christopher Schmidt
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -18,7 +18,7 @@
         TEMPLATE_PARAMS_SEQ, \
         (0)NAMESPACE_SEQ, \
         NAME, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
         2) \
                                                                                 \
     BOOST_FUSION_ADAPT_TPL_STRUCT( \
@@ -31,7 +31,7 @@
     BOOST_FUSION_DEFINE_STRUCT_IMPL( \
         (0)NAMESPACE_SEQ, \
         NAME, \
- BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 ATTRIBUTES,_END), \
+ BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0(0,0)ATTRIBUTES,_END), \
         2) \
                                                                                 \
     BOOST_FUSION_ADAPT_STRUCT( \

Modified: trunk/boost/fusion/adapted/struct/detail/adapt_base.hpp
==============================================================================
--- trunk/boost/fusion/adapted/struct/detail/adapt_base.hpp (original)
+++ trunk/boost/fusion/adapted/struct/detail/adapt_base.hpp 2011-01-19 12:46:05 EST (Wed, 19 Jan 2011)
@@ -1,7 +1,7 @@
 /*=============================================================================
     Copyright (c) 2001-2009 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
- Copyright (c) 2009-2010 Christopher Schmidt
+ Copyright (c) 2009-2011 Christopher Schmidt
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -23,6 +23,7 @@
 #include <boost/preprocessor/seq/seq.hpp>
 #include <boost/preprocessor/tuple/eat.hpp>
 #include <boost/preprocessor/tuple/elem.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/tag.hpp>
 #include <boost/mpl/eval_if.hpp>
@@ -185,18 +186,21 @@
                                                                                 \
         namespace extension \
         { \
- BOOST_PP_SEQ_FOR_EACH_I_R( \
- 1, \
- BOOST_FUSION_ADAPT_STRUCT_BASE_UNPACK_AND_CALL, \
- (ATTRIBUTES_CALLBACK,TEMPLATE_PARAMS_SEQ,NAME_SEQ), \
- ATTRIBUTES_SEQ) \
+ BOOST_PP_IF( \
+ BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ)), \
+ BOOST_PP_SEQ_FOR_EACH_I_R, \
+ BOOST_PP_TUPLE_EAT(4))( \
+ 1, \
+ BOOST_FUSION_ADAPT_STRUCT_BASE_UNPACK_AND_CALL, \
+ (ATTRIBUTES_CALLBACK,TEMPLATE_PARAMS_SEQ,NAME_SEQ), \
+ BOOST_PP_SEQ_TAIL(ATTRIBUTES_SEQ)) \
                                                                                 \
             template< \
                 BOOST_FUSION_ADAPT_STRUCT_UNPACK_TEMPLATE_PARAMS( \
                     TEMPLATE_PARAMS_SEQ) \
> \
             struct struct_size<BOOST_FUSION_ADAPT_STRUCT_UNPACK_NAME(NAME_SEQ)> \
- : mpl::int_<BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ)> \
+ : mpl::int_<BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ))> \
             {}; \
                                                                                 \
             template< \

Modified: trunk/boost/fusion/adapted/struct/detail/define_struct.hpp
==============================================================================
--- trunk/boost/fusion/adapted/struct/detail/define_struct.hpp (original)
+++ trunk/boost/fusion/adapted/struct/detail/define_struct.hpp 2011-01-19 12:46:05 EST (Wed, 19 Jan 2011)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2010 Christopher Schmidt
+ Copyright (c) 2010-2011 Christopher Schmidt
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -201,7 +201,7 @@
>::param_type BOOST_PP_CAT(_,I)
 
 #define BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR_N( \
- TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
+ TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
                                                                                 \
         NAME(BOOST_PP_SEQ_FOR_EACH_I_R( \
                 1, \
@@ -228,7 +228,7 @@
>::param_type BOOST_PP_CAT(_,I)
 
 #define BOOST_FUSION_DEFINE_STRUCT_CTOR_N( \
- NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
+ NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
                                                                                 \
         NAME(BOOST_PP_SEQ_FOR_EACH_I_R( \
                 1, \
@@ -242,15 +242,44 @@
                 ATTRIBUTES_SEQ) \
         {}
 
-#define BOOST_FUSION_DEFINE_STRUCT_CTOR(ATTRIBUTES_SEQ) \
+#define BOOST_FUSION_DEFINE_STRUCT_CTOR( \
+ NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
+ \
     BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ)), \
         BOOST_FUSION_DEFINE_STRUCT_CTOR_N, \
- BOOST_FUSION_DEFINE_STRUCT_CTOR_1)
+ BOOST_FUSION_DEFINE_STRUCT_CTOR_1)( \
+ NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE)
 
-#define BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR(ATTRIBUTES_SEQ) \
+#define BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR( \
+ TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
+ \
     BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ)), \
         BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR_N, \
- BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR_1)
+ BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR_1)( \
+ TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE)
+
+#define BOOST_FUSION_DEFINE_NONEMPTY_STRUCT_IMPL( \
+ NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
+ \
+ BOOST_FUSION_DEFINE_STRUCT_IMPL_IMPL( \
+ NAME, BOOST_PP_SEQ_TAIL(ATTRIBUTES_SEQ), ATTRIBUTE_TUPEL_SIZE) \
+ \
+ BOOST_FUSION_DEFINE_STRUCT_CTOR( \
+ NAME, BOOST_PP_SEQ_TAIL(ATTRIBUTES_SEQ), ATTRIBUTE_TUPEL_SIZE)
+
+#define BOOST_FUSION_DEFINE_EMPTY_STRUCT_IMPL( \
+ NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
+ \
+ template<typename Seq> \
+ NAME(Seq const&) \
+ {} \
+ \
+ template<typename Seq> \
+ self_type& \
+ operator=(Seq const& seq) \
+ { \
+ return *this; \
+ }
 
 #define BOOST_FUSION_DEFINE_STRUCT_IMPL( \
     NAMESPACE_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
@@ -261,15 +290,32 @@
     { \
         typedef NAME self_type; \
                                                                                 \
- BOOST_FUSION_DEFINE_STRUCT_IMPL_IMPL( \
- NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
- \
- BOOST_FUSION_DEFINE_STRUCT_CTOR(ATTRIBUTES_SEQ)( \
- NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
+ BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ)), \
+ BOOST_FUSION_DEFINE_NONEMPTY_STRUCT_IMPL, \
+ BOOST_FUSION_DEFINE_EMPTY_STRUCT_IMPL)( \
+ NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
     }; \
                                                                                 \
     BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_END(NAMESPACE_SEQ)
 
+#define BOOST_FUSION_DEFINE_NONEMPTY_TPL_STRUCT_IMPL( \
+ TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
+ \
+ BOOST_FUSION_DEFINE_STRUCT_IMPL_IMPL( \
+ NAME, BOOST_PP_SEQ_TAIL(ATTRIBUTES_SEQ), ATTRIBUTE_TUPEL_SIZE) \
+ \
+ BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR( \
+ TEMPLATE_PARAMS_SEQ, \
+ NAME, \
+ BOOST_PP_SEQ_TAIL(ATTRIBUTES_SEQ), \
+ ATTRIBUTE_TUPEL_SIZE)
+
+#define BOOST_FUSION_DEFINE_EMPTY_TPL_STRUCT_IMPL( \
+ TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
+ \
+ BOOST_FUSION_DEFINE_EMPTY_STRUCT_IMPL( \
+ NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE)
+
 #define BOOST_FUSION_DEFINE_TPL_STRUCT_IMPL( \
     TEMPLATE_PARAMS_SEQ, \
     NAMESPACE_SEQ, \
@@ -287,11 +333,10 @@
     { \
         typedef NAME self_type; \
                                                                                 \
- BOOST_FUSION_DEFINE_STRUCT_IMPL_IMPL( \
- NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
- \
- BOOST_FUSION_DEFINE_TPL_STRUCT_CTOR(ATTRIBUTES_SEQ)( \
- TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE) \
+ BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ)), \
+ BOOST_FUSION_DEFINE_NONEMPTY_TPL_STRUCT_IMPL, \
+ BOOST_FUSION_DEFINE_EMPTY_TPL_STRUCT_IMPL)( \
+ TEMPLATE_PARAMS_SEQ, NAME, ATTRIBUTES_SEQ, ATTRIBUTE_TUPEL_SIZE)\
     }; \
                                                                                 \
     BOOST_FUSION_ADAPT_STRUCT_NAMESPACE_DEFINITION_END(NAMESPACE_SEQ)


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk