PrevUpHomeNext

With Multiple Arguments and a Collector Class

Multi-argument select() supports mapped classes as an output format, as an alternative to std::tuples. The generated SQL is no different, but the classes might afford some extra convenience, if you like to use meaningful member names instead of get<0>() etc.

If C is a mapped class, with mapped members m0, m1, ... (in the order they were listed to QUINCE_MAP_CLASS), and with no mapped bases, then you can call q.select<C>(exprn0, exprn1, ... ), provided that:

q.select<C>(exprn0, exprn1, ... ) returns a query with the following characteristics:

Examples
// Somewhere in a namespace, not in a function:

struct assortment {
    point p;
    float plus;
    float minus;
};
QUINCE_MAP_CLASS(assortment, (p)(plus)(minus));


// Somewhere inside a function:

// Use operator* to get points's entire value mapper:
//
const query<assortment> assortments =
    points
    .select<assortment>(*points, points->x + points->y, points->x - points->y);

// Classes are statically mapped; therefore assortments->p is not just an
// abstract_mapper<point>, it's a class_mapper<point>.  So we can use its
// class_mapper features, e.g ".x":
//
const query<float> xs_times_pluses =
    assortments
    .select(assortments->p.x * assortments->plus);

// assortments->p is strictly identical to *point,
// so we can use one instead of the other (stylistically questionable though):
//
const query<float> xs_times_pluses_again =
    assortments
    .select(points->x * assortments->plus);

PrevUpHomeNext