PrevUpHomeNext

With Multiple Arguments

For any query q, you can call q.select(exprn0, exprn1, ... ), provided that:

q's value mapper will be visible to each exprni.

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

Examples
// Most typical case: Each of these queries produces one tuple per point in points:
//
const query<std::tuple<float, float>> swap =
    points
    .select(points->y, points->x);
const query<std::tuple<float, float>> pluses_and_minuses =
    points
    .select(points->x + points->y, points->x - points->y);

// Practise using a query of tuples:
//
const query<float> pluses_times_minuses =
    pluses_and_minuses
    .select(pluses_and_minuses->get<0>() * pluses_and_minuses->get<1>());

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

// Classes are statically mapped; therefore points_and_pluses_and_minuses->get<0>() 
// 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 =
    points_and_pluses_and_minuses
    .select(points_and_pluses_and_minuses->get<0>().x * points_and_pluses_and_minuses->get<1>());

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

PrevUpHomeNext