Feature/distance fix errors in variant support

1) add missing keywords (template, typename)
2) remove inner template parameter that shadows outer template parameter
3) fix return type of variant visitor