Pass callback as const ref.

This fixes compilation with GCC.