|
Boost : |
Subject: Re: [boost] quince: queries in C++ expressions
From: Michael Shepanski (mps_at_[hidden])
Date: 2014-07-17 01:08:36
On 17/07/2014 2:38 PM, pfultz2 wrote:
>> When I come back from the tuples detour, how will I get this class
>> defined?
> There is no need to define this class. Boost.Fusion takes care of it
> already.
Again, you say "takes care of it" -- but your "it" is not the "it" that
I need. :)
Let's look from the point of view of a quince user. The user writes
some code like this:
extern table<point> points;
for (const point &p: points.where(points->x < 4.0f))
std::cout << p.y << std::endl;
Look at the expression "points->x". "points" is the table. Its
operator->() returns a pointer to that table's value mapper. points->x
is a mapper for one part of points.
In order to make this syntax work, the mapper type has to have a member
named x, i.e. a member whose name is the same as the name of the value
type's member. This is a requirement, so that my EDSL looks the way I
want it to look.
The QUINCE_MAP_CLASS macro makes this happen by defining a structure
with members named in this way.
If you can do *that* with Boost.Fusion then perhaps you can show us the
code that does it, and we discuss costs and benefits.
>> If I were to take the tuples detour, that would be the only
>> site where it happens.
> What do you mean?
I mean, if I were to take the approach of implementing QUINCE_MAP_CLASS
and QUINCE_MAP_CLASS_WITH_BASES by (a) using Boost.Fusion to define some
kind of tuple, and then (b) using some other means to turn that tuple
into the class I need, then I expect it would all be done in one place,
_viz._ inside the definition of quince's private macro
QUINCE_DEFINE_CLASS_MAPPER_WITH_BASES. So I would be introducing a
dependency on Boost.Fusion for the sake of changing one point in my code.
--- Michael
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk