|
Boost Users : |
Subject: Re: [Boost-users] [fusion] BOOST_FUSION_DEFINE_STRUCT with user defined methods
From: Joel de Guzman (djowel_at_[hidden])
Date: 2014-08-27 23:09:53
On 8/27/14, 2:07 PM, Tobias Loew wrote:
> Hi,
>
> I often use BOOST_FUSION_DEFINE_STRUCT not to generate a fusion-sequence per
> se, but to get a struct with
>
> - default initialisation for all members
> - a reasonable set of constructors
> - equality-check
> - all above without additional code
>
>
> But sometimes I would like to have additional methods in those structs, but
> deriving from those or fusion-adapting them loses at least one of the nice
> properties above.
> After looking at the BOOST_FUSION_DEFINE_STRUCT implementation I though
> about splitting the makro BOOST_FUSION_DEFINE_STRUCT_IMPL an inject my code
> in-between.
> Now my questions are:
>
> - Is there anything I've overseen and might detroy some fusion-mechanism?
> - Is there any chance to get macros like
> BOOST_FUSION_DEFINE_STRUCT_[BEGIN|END] (and also for the other
> BOOST_FUSION_DEFINE_... macros?
The only problem I see is that the mechanism is private and is not
guaranteed to remain unchanged. Actually there's work in progress
cleaning up the macros and the implementation by Damien Buhl.
CC'ing him now. Your thoughts, Damien?
Regards,
-- Joel de Guzman http://www.ciere.com http://boost-spirit.com http://www.cycfi.com/
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net