Work around gcc-4.8 bug

Seems that gcc-4.8 has problems with templates that use abstract types.
Whatever. Its almost dead code, the template is used in only one place,
so just expand the template by hand.