Meta dist

This changes the distance policy implementation.
Some code duplication is removed.
Dot is computed with std function.
Some cpp tests are added for cartesian distance.