Fixes to templated code for GCC 4.2 on Mac

These are necessary to propagate template arguments in order to enable
the class to compile with GCC 4.2 on the Mac (and possibly other older
compilers).

Change-Id: I1083bbb9206e04fb1a28aa93400f02fe254a55b4
Merge branch 'mac-gcc42-fixes'

Change-Id: Icc59098ef59b3fc02e3b1d81f3ecec2840e405d3