Boost logo

Boost :

Subject: Re: [boost] JSON Parser + Boost Fusion + adapted structs
From: Max Skvortsov (asso.trasso_at_[hidden])
Date: 2013-05-21 23:03:07


Stephan Bourgeois <stephanb2 <at> gmail.com> writes:

>
I have been looking at Boost.Fusion to enable the parser to
> "fill in" the values in the struct.
>
> It looks like I'm after a solution described in the following post:
> http://stackoverflow.com/questions/13830792/simulate-compile-time-
reflection-in-c

I used BOOST_FUSION_ADAPT_STRUCT in conjuction with boost.serialization to
automate serialization of messages between clients and server in my
application. It just reflects simple C++ structs with data to XML/TEXT for
pass them throughout network.
After few experiments with RTTI, some kind of type erasure (with "variant"
and
"any" types), true object-oriented approach and boost.fusion I have found
that
the last one gives more benefits and fit in static type system of C++ more
naturally.

>
> Could anyone tell me if this is a good starting point, and/or if there are
> other ways of achieving this.
> Thank you,
> Stephan.
>

As alternate you look at implementation of serialization in
Different ORM libraries, but they use external tools
Message passing and RMI libraries like Apache.Thief or libcppa, but they use
RTTI AFAIK.

I think boost.fusion is the only one way to implement true compile-time
reflection. With certain restrictions, of course.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk