|
Boost : |
From: Edward Diener (eldiener_at_[hidden])
Date: 2021-03-02 14:03:56
On 3/2/2021 8:48 AM, Andrzej Krzemienski via Boost wrote:
> Hi Everyone (but mainly Peter),
> Boost.Spirit needs to have an index-based access to user defined types, as
> explained in the tutorial:
> https://www.boost.org/doc/libs/1_75_0/libs/spirit/doc/x3/html/spirit_x3/tutorials/employee.html
> Currently Boost.Spirit uses the interface of Boost.Fusion, and users are
> encouraged to use macros like BOOST_FUSION_ADAPT_STRUCT:
> https://www.boost.org/doc/libs/1_75_0/libs/fusion/doc/html/fusion/adapted/adapt_struct.html
>
> The first question is, can Boost.Describe's interface be plugged into
> Boost.Spirit?
> It is not that obvious to me for a couple of reasons. For instance, it
> would require an interface in Boost.Describe for answering the question,
> "has describe::members been specialized for type X"?
>
> The second question is, can is Boost.Describe capable of replacing the
> adapter macros in Boost.Fusion?
> For instance, Boost.Fusion allows the users to define and adapt a user
> defined type with one macro:
> https://www.boost.org/doc/libs/1_75_0/libs/fusion/doc/html/fusion/adapted/define_struct.html
>
> This is similar in concept to what macro BOOST_DEFINE_ENUM does for enums.
> What is the motivation behind allowing the definition of enums in this way
> but not classes (at least the aggregate classes).
>
> My general observation is that we have a number of libraries with
> overlapping goals:
> Boost.Describe,
> Boost.PFR,
> Boost.Fusion (the part for adapting UDTs)
>
> Maybe it is ok, but does it mean that there are so many incompatible use
> cases? Maybe there is a way to reduce this number.
Boost.Fusion/Boost.Spirit are C++03 libraries while Describe is a C++14
library. So while Describe might be capable of replacing the
BOOST_FUSION_ADAPT_STRUCT interface in Boost.Fusion I would imagine that
Boost.Fusion/Boost.Spirit might have to upgrade their minimum C++ level
to C++14 in order to do so.
I agree with you that having multiple libraries use a common interface
is certainly desired, and thought about the same thing you have
expressed here when I read about the Describe macros.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk