summaryrefslogtreecommitdiff
path: root/src/common/include/gudhi/distance_functions.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/include/gudhi/distance_functions.h')
-rw-r--r--src/common/include/gudhi/distance_functions.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/common/include/gudhi/distance_functions.h b/src/common/include/gudhi/distance_functions.h
index 7f33a804..f6e2ab5a 100644
--- a/src/common/include/gudhi/distance_functions.h
+++ b/src/common/include/gudhi/distance_functions.h
@@ -27,6 +27,8 @@
#include <type_traits> // for std::decay
#include <iterator> // for std::begin, std::end
+namespace Gudhi {
+
/** @file
* @brief Global distance functions
*/
@@ -35,7 +37,7 @@
* have the same dimension. */
class Euclidean_distance {
public:
- template< typename Point >
+ template< typename Point >
auto operator()(const Point& p1, const Point& p2) const -> typename std::decay<decltype(*std::begin(p1))>::type {
auto it1 = p1.begin();
auto it2 = p2.begin();
@@ -46,11 +48,8 @@ class Euclidean_distance {
}
return std::sqrt(dist);
}
- template< typename T >
- T operator() ( const std::pair< T,T >& f , const std::pair< T,T >& s )
- {
- return sqrt( (f.first-s.first)*(f.first-s.first) + (f.second-s.second)*(f.second-s.second) );
- }
};
+} // namespace Gudhi
+
#endif // DISTANCE_FUNCTIONS_H_