For any query q, q.order(...)
builds a query whose output is q's output, sorted
in a specified order. It's a wrapper for SQL's ORDER BY.
For any query q, you can call q.order(exprn0, exprn1, ...),
provided that:
exprni is an abstract_mapper<Ti> for some mapped type Ti.
q's value mapper will be visible
to each exprni.
q.order(exprn0, exprn1, ...)
returns a query with the
following characteristics:
q's
q's.
q
would produce, ordered lexicographically by the exprnis,
with exprn0 the most significant, exprn1
the next most significant and so on.
exprni is as follows:
To specify that one of the exprni's is to be
in descending order, apply the prefix operator -
to it. To specify (redundantly) that it is to be in ascending order, apply
the prefix operator +. This
works whether Ti is an arithmetic type or not.
order(...).order(...).order(...)...
If we chain order(...)calls together, e.g. q.order(A).order(B).order(C), then pipeline semantics applies as usual.
So the final (hence most significant) ordering is by C.
At each stage the order is stable
with respect to the previous stages, so it's equivalent to q.order(C, B, A).