Type finagling to reduce backwards indirection in templates