With Single-Value Output: evaluate()

The evaluate() method evaluates one server-side expression over the output of a query, expecting exactly one result, and it returns that result. Inevitably the expression will be a call to an aggregate function.

For any query q, you can call q.evaluate(exprn), provided that exprn is an exprn_mapper<T> for some mapped type T. q's value mapper will be visible to exprn.

q.evaluate(exprn) returns a T (i.e. exprn's result type).

So, to print the sum of the lengths of all movie titles:

std::cout << movies.evaluate(sum(length(movies->title))) << std::endl;
Standard Evaluations: size(), empty()

The functions size() and empty() perform two of the most common uses of evaluate().

For any query q: