Fix compilation warning under clang

Clang complains about adding const to a reference type having no effect.
Fix this by adding and using a const_ref_t.