examples: add aggregation example with compile time checks.

Now we can just include it in the generated docs and ensure it compiles
correctly like the others.