Commit d0500388 authored by Edwin Carlinet's avatar Edwin Carlinet
Browse files

Fix dangling ref to the range passed to ranges::rows(...).

parent b0c042b5
......@@ -29,7 +29,8 @@ namespace mln
static_assert(mln::is_a<InputImage, Image>());
static_assert(::ranges::Predicate<UnaryPredicate, image_reference_t<InputImage>>());
for (auto r : ranges::rows(input.new_values()))
auto&& vals = input.new_values();
for (auto r : ranges::rows(vals))
if (!::ranges::all_of(r, p))
return false;
return true;
......@@ -42,7 +43,8 @@ namespace mln
static_assert(mln::is_a<InputImage, Image>());
static_assert(std::is_convertible_v<image_reference_t<InputImage>, bool>);
for (auto r : ranges::rows(input.new_values()))
auto&& vals = input.new_values();
for (auto r : ranges::rows(vals))
for (auto&& v : r)
if (!v)
return false;
......
......@@ -84,7 +84,8 @@ namespace mln
{
static_assert(mln::is_a<OutputImage, Image>());
for (auto row : ranges::rows(f.new_values()))
auto&& vals = f.new_values();
for (auto row : ranges::rows(vals))
::ranges::fill(row, v);
}
} // namespace experimental
......
......@@ -76,7 +76,6 @@ namespace mln
// Checks
// FIXME: accessible prerequisite
// FIXME: can be indexable
static_assert(::ranges::ForwardRange<rng_t>());
private:
struct pix_filter_fn
......
......@@ -23,8 +23,11 @@
if (bool __mln_has_been_broken = false; false) \
{ \
} \
else if (auto&& __mln_rng = RNG; false) \
{ \
} \
else \
for (auto&& __mln_inner_rng : mln::ranges::rows(RNG)) \
for (auto&& __mln_inner_rng : mln::ranges::rows(__mln_rng)) \
if (__mln_has_been_broken) \
break; \
else \
......
......@@ -33,9 +33,9 @@ namespace mln::ranges
private:
using base_t = ::ranges::remove_if_view<Rng, Pred>;
::ranges::semiregular_t<Pred> get_pred() const
{
return reinterpret_cast<const details::remove_if_view_access<Rng, Pred>*>(this)
auto& get_pred() const
{
return reinterpret_cast<const details::remove_if_view_access<Rng, Pred>*>(this)
->details::template remove_if_view_access<Rng, Pred>::box::get();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment