summaryrefslogtreecommitdiff
path: root/src/Alpha_complex
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2020-06-28 09:52:39 +0200
committerMarc Glisse <marc.glisse@inria.fr>2020-06-28 09:52:39 +0200
commit88f7806d69115c1626c4abfb821b598a3078e18d (patch)
treecc6cd6ce38fc18932041980a5f9eb607f5e43899 /src/Alpha_complex
parentb12be95458023397cd8d6f5bc2bed2c007eeefbc (diff)
Use boost::size for unknown incoming ranges
Diffstat (limited to 'src/Alpha_complex')
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex_3d.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
index c29905f4..231b1ea9 100644
--- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
@@ -14,6 +14,7 @@
#include <boost/version.hpp>
#include <boost/variant.hpp>
+#include <boost/range/size.hpp>
#include <gudhi/Debug_utils.h>
#include <gudhi/Alpha_complex_options.h>
@@ -299,14 +300,14 @@ Weighted_alpha_complex_3d::Weighted_point_3 wp0(Weighted_alpha_complex_3d::Bare_
Alpha_complex_3d(const InputPointRange& points, WeightRange weights) {
static_assert(Weighted, "This constructor is not available for non-weighted versions of Alpha_complex_3d");
static_assert(!Periodic, "This constructor is not available for periodic versions of Alpha_complex_3d");
- GUDHI_CHECK((weights.size() == points.size()),
+ GUDHI_CHECK(boost::size(weights) == boost::size(points),
std::invalid_argument("Points number in range different from weights range number"));
std::vector<Weighted_point_3> weighted_points_3;
std::size_t index = 0;
- weighted_points_3.reserve(points.size());
- while ((index < weights.size()) && (index < points.size())) {
+ weighted_points_3.reserve(boost::size(points));
+ while ((index < boost::size(weights)) && (index < boost::size(points))) {
weighted_points_3.push_back(Weighted_point_3(points[index], weights[index]));
index++;
}
@@ -388,7 +389,7 @@ Weighted_alpha_complex_3d::Weighted_point_3 wp0(Weighted_alpha_complex_3d::Bare_
FT z_min, FT x_max, FT y_max, FT z_max) {
static_assert(Weighted, "This constructor is not available for non-weighted versions of Alpha_complex_3d");
static_assert(Periodic, "This constructor is not available for non-periodic versions of Alpha_complex_3d");
- GUDHI_CHECK((weights.size() == points.size()),
+ GUDHI_CHECK(boost::size(weights) == boost::size(points),
std::invalid_argument("Points number in range different from weights range number"));
// Checking if the cuboid is the same in x,y and z direction. If not, CGAL will not process it.
GUDHI_CHECK(
@@ -398,14 +399,14 @@ Weighted_alpha_complex_3d::Weighted_point_3 wp0(Weighted_alpha_complex_3d::Bare_
std::vector<Weighted_point_3> weighted_points_3;
std::size_t index = 0;
- weighted_points_3.reserve(points.size());
+ weighted_points_3.reserve(boost::size(points));
#ifdef GUDHI_DEBUG
// Defined in GUDHI_DEBUG to avoid unused variable warning for GUDHI_CHECK
FT maximal_possible_weight = 0.015625 * (x_max - x_min) * (x_max - x_min);
#endif
- while ((index < weights.size()) && (index < points.size())) {
+ while ((index < boost::size(weights)) && (index < boost::size(points))) {
GUDHI_CHECK((weights[index] < maximal_possible_weight) && (weights[index] >= 0),
std::invalid_argument("Invalid weight at index " + std::to_string(index + 1) +
". Must be positive and less than maximal possible weight = 1/64*cuboid length "