The free function join()
builds a query that produces all combinations
of the outputs of some other queries. It's a wrapper for SQL's JOIN
.
For any queries q0
, q1
,
..., you can call join(
q0
,
q1
,
...)
.
It returns a junction
(that's a kind of query) with the following characteristics:
std::tuple<
T0
,
T1
,
...>
,
where T0
, T1
... are the value types of q0
, q1
... respectively.
tuple_mapper<
T0
,
T1
,
...)
,
in which the i
'th member mapper is identical
to qi
's value mapper.
std::tuple
s,
formed from each combination of the outputs of q0
,
q1
, ... .
const query<std::tuple<cinema, screen, movie>> combinations = join(cinemas, screens, movies);
For any queries l
, r
,
the call l
.join(
r
)
is equivalent to join(
l
,
r
)
.
Note that the join()
method, unlike the join()
free function, always makes queries
that produce tuples of two elements. E.g. a
.join(
b
).join(
c
)
produces outputs of the form {(
-- ,
-- },
-- }
;
whereas join(
a
,
b
,
c
)
produces outputs of the form {
-- ,
-- ,
-- }
.
const query<std::tuple<screen, movie>> possible_screenings = screens.join(movies);