mirror of https://github.com/CGAL/cgal
allow a range as parameter
The preview implementation enforced the use of a full container.
This commit is contained in:
parent
820762da52
commit
e2d11a0fc5
|
|
@ -88,11 +88,11 @@ add_points_from_generator(C3T3& c3t3,
|
|||
}
|
||||
};
|
||||
|
||||
auto output_it = boost::make_function_output_iterator(push_initial_point);
|
||||
if (nb_initial_points > 0)
|
||||
generator(boost::make_function_output_iterator(push_initial_point), nb_initial_points);
|
||||
generator(output_it, nb_initial_points);
|
||||
else
|
||||
generator(boost::make_function_output_iterator(push_initial_point));
|
||||
|
||||
generator(output_it);
|
||||
|
||||
// Insert points and set their index and dimension
|
||||
for (const auto& [wpoint, dimension, index] : initial_points)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,14 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
template <typename Range> class Non_copyable_range_view {
|
||||
Range& r;
|
||||
public:
|
||||
Non_copyable_range_view(Range& r) : r(r) {}
|
||||
auto begin() const { return r.begin(); }
|
||||
auto end() const { return r.end(); }
|
||||
};
|
||||
|
||||
template <typename K, typename Concurrency_tag = CGAL::Sequential_tag>
|
||||
struct Polyhedron_tester : public Tester<K>
|
||||
{
|
||||
|
|
@ -78,6 +86,10 @@ struct Polyhedron_tester : public Tester<K>
|
|||
std::vector<Initial_point> initial_points = { Initial_point{ Weighted_point(.5, .5, .5), 3, Index{}} };
|
||||
c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, CGAL::parameters::initial_points(initial_points));
|
||||
|
||||
// test initial_points with a non-copyable range
|
||||
Non_copyable_range_view initial_points_view{ initial_points };
|
||||
c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, CGAL::parameters::initial_points(initial_points_view));
|
||||
|
||||
// test initial_points_generator with a generator generating tuple-like object
|
||||
auto initial_points_generator = [](auto oit, const int) {
|
||||
*oit++ = Initial_point{ Weighted_point(.5, .5, .5), 3, Index{} };
|
||||
|
|
|
|||
|
|
@ -196,8 +196,16 @@ struct Initialization_options
|
|||
using Initial_points_range
|
||||
= typename CGAL::Default::Get<InitialPointsRange, std::vector<Default_initial_point_type>>::type;
|
||||
|
||||
using Initial_points_const_iterator = typename Initial_points_range::const_iterator;
|
||||
using Initial_point = typename std::iterator_traits<Initial_points_const_iterator>::value_type;
|
||||
template <typename Range>
|
||||
static auto cbegin(Range&& range) {
|
||||
return std::cbegin(std::forward<Range>(range));
|
||||
}
|
||||
|
||||
template <typename Range>
|
||||
static auto cend(Range&& range) {
|
||||
return std::cend(std::forward<Range>(range));
|
||||
}
|
||||
using Initial_points_const_iterator = decltype(cbegin(std::declval<Initial_points_range>()));
|
||||
|
||||
Initialization_options()
|
||||
{}
|
||||
|
|
@ -205,8 +213,8 @@ struct Initialization_options
|
|||
Initialization_options(const Initial_points_generator& generator,
|
||||
const Initial_points_range& initial_points)
|
||||
: initial_points_generator_(generator)
|
||||
, begin_it(initial_points.begin())
|
||||
, end_it(initial_points.end())
|
||||
, begin_it(cbegin(initial_points))
|
||||
, end_it(cend(initial_points))
|
||||
{}
|
||||
|
||||
template<typename OutputIterator>
|
||||
|
|
|
|||
Loading…
Reference in New Issue