|
Boost : |
Subject: Re: [boost] quince: queries in C++ expressions
From: Michael Shepanski (mps_at_[hidden])
Date: 2014-07-15 08:45:20
On 15/07/2014 10:15 PM, Mathias Gaunard wrote:
> On 15/07/14 08:04, Michael Shepanski wrote:
>
>> 1. If you want some class to be mapped into SQL data, quince lets you
>> write this sort of thing:
>>
>> struct point {
>> float x;
>> float y;
>> };
>> QUINCE_MAP_CLASS(point, (x)(y))
>>
>> extern database db;
>> table<point> points(db, "points");
>>
>> The macro QUINCE_MAP_CLASS uses a bit of Boost.Preprocessor magic and a
>> bit of template metaprogramming to produce all the statically typed
>> metadata that quince needs, regarding the user's type. There is no code
>> generation step.
>
> There are already macros to do this in Boost Fusion.
> Why not re-use them?
Could you clarify what you mean by "do this"? QUINCE_MAP_CLASS builds a
class with exactly the data members, function members, and bases that
quince requires.
Also, if quince did use Booost.Fusion, it would only be at one site. So
it seemed best to avoid the inter-library dependence. I think I'm
following the advice in http://www.boost.org/development/reuse.html.
> Boost.Fusion is a tuple manipulation library initially developed for a
> parser generator EDSL.
I'm not actually doing tuple manipulation here. That's not to say the
task couldn't be solved by a detour through tuples, but it /would/ be a
detour.
Regards,
--- Michael
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk