[distance] Add variant support

Add variant dispatch layer to the distance algorithm.
I did not see any test cases for variant in the other algorithms so I'm not sure how to implement them... The current tests compile and pass with MSVC 2012.