diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-03-22 15:12:17 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-03-22 15:12:17 +0000 |
commit | b69cc713465675a9bab998cb0688eb91390978a6 (patch) | |
tree | 09c8d601c45b9a6c143beaa1c495a74cffa8b3a6 /src/common/include | |
parent | 1f3716292673a56413d3501b4b98b54416d193ed (diff) |
code review : use std::begin, std::end and boost::size
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cechcomplex_vincent@3305 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: e59699bc13ae66476001ef5f648759fef68ee76a
Diffstat (limited to 'src/common/include')
-rw-r--r-- | src/common/include/gudhi/distance_functions.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/common/include/gudhi/distance_functions.h b/src/common/include/gudhi/distance_functions.h index 429a5fa7..20b04000 100644 --- a/src/common/include/gudhi/distance_functions.h +++ b/src/common/include/gudhi/distance_functions.h @@ -28,6 +28,7 @@ #include <gudhi/Miniball.hpp> #include <boost/range/metafunctions.hpp> +#include <boost/range/size.hpp> #include <cmath> // for std::sqrt #include <type_traits> // for std::decay @@ -74,13 +75,11 @@ class Euclidean_distance { * The points are assumed to have the same dimension. */ class Minimal_enclosing_ball_radius { public: - // boost::range_value is not SFINAE-friendly so we cannot use it in the return type template< typename Point > typename std::iterator_traits<typename boost::range_iterator<Point>::type>::value_type operator()(const Point& p1, const Point& p2) const { return Euclidean_distance()(p1, p2) / 2.; } - // boost::range_value is not SFINAE-friendly so we cannot use it in the return type template< typename Point_cloud, typename Point_iterator = typename boost::range_const_iterator<Point_cloud>::type, typename Point= typename std::iterator_traits<Point_iterator>::value_type, @@ -90,11 +89,11 @@ class Minimal_enclosing_ball_radius { operator()(const Point_cloud& point_cloud) const { using Min_sphere = Miniball::Miniball<Miniball::CoordAccessor<Point_iterator, Coordinate_iterator>>; - Min_sphere ms(point_cloud.begin()->end() - point_cloud.begin()->begin(), point_cloud.begin(),point_cloud.end()); + Min_sphere ms(boost::size(*point_cloud.begin()), point_cloud.begin(),point_cloud.end()); #ifdef DEBUG_TRACES std::cout << "Minimal_enclosing_ball_radius = " << std::sqrt(ms.squared_radius()) << " | nb points = " - << point_cloud.end() - point_cloud.begin() << " | dimension = " - << point_cloud.begin()->end() - point_cloud.begin()->begin() << std::endl; + << boost::size(point_cloud) << " | dimension = " + << boost::size(*point_cloud.begin()) << std::endl; #endif // DEBUG_TRACES return std::sqrt(ms.squared_radius()); |