const query<cinema> local_cinemas =
cinemas
.where(within_radius);
local_cinemas is a query
that filters the records in cinemas
by the predicate within_radius.
Its output is all the records in cinemas
for which the predicate within_radius
evaluates to true.
Here are two things to know about queries:
tables
do), and it is a template parameter to the query
class; e.g. query<cinema>
has the value type cinema.
tables
do), and their operator->() returns a pointer to it, just
as a table's operator->()
does.
In the case of local_cinemas,
its value mapper is identical to cinemas's
value mapper, in the strictest sense of “identical”: cinemas.operator->()
== local_cinemas.operator->(). That is because local_cinemas
was created by where(),
which has the following rules:
Q.where(...)'s value type is identical to Q's.
Q.where(...)'s value mapper is identical to Q's.
(which, by the way, are also true of Q.distinct(...),
Q.distinct_on(...), Q.except(...),
Q.except_all(...), Q.intersect(...),
Q.intersect_all(...), Q.limit(...),
Q.order(...), Q.skip(...),
Q.union_(...), and Q.union_all(...).
On the other hand there are somewhat different rules for select()
and functions in the join() family.)
And here are two more things to know about queries (and tables also):
cinemas to make local_cinemas),
the first one is unchanged, and still usable, e.g. you could build
on it again to make yet another query.