Commit ef477043 authored by Edwin Carlinet's avatar Edwin Carlinet

Small fixes for compilation with Clang 10 & GCC 10

* Tag final classes as final.
* Fix concept-based specialization
* Fix warnings
parent c790aaec
......@@ -713,11 +713,11 @@ namespace mln
template <class Impl>
constexpr std::size_t _box<Impl>::size() const noexcept
{
std::size_t sz = 1;
int sz = 1;
for (int k = 0; k < this->dim(); ++k)
sz *= (this->__end(k) - this->__begin(k));
if (sz < 0)
sz = 0;
return 0;
return sz;
}
......
......@@ -120,7 +120,11 @@ namespace mln::concepts
} &&
image_indexable_v<I> &&
requires (I ima, image_index_t<I> k) {
{ ima[k] } -> ::concepts::same_as<image_reference_t<I>>; // For concrete image it returns a const_reference
#if __GNUC__ == 9
{ ima[k] } -> ::concepts::same_as<image_reference_t<I>>&&; // For concrete image it returns a const_reference
#else
{ ima[k] } -> ::concepts::same_as<image_reference_t<I>>; // For concrete image it returns a const_reference
#endif
};
......@@ -133,7 +137,11 @@ namespace mln::concepts
WritableImage<I> &&
IndexableImage<I> &&
requires(I ima, image_index_t<I> k, image_value_t<I> v) {
#if __GNUC__ == 9
{ ima[k] = v } -> ::concepts::same_as<image_reference_t<I>>&&;
#else
{ ima[k] = v } -> ::concepts::same_as<image_reference_t<I>>;
#endif
};
} // namespace detail
......@@ -145,10 +153,17 @@ namespace mln::concepts
Image<I> &&
image_accessible_v<I> &&
requires (I ima, image_point_t<I> p) {
#if __GNUC__ == 9
{ ima(p) } -> ::concepts::same_as<image_reference_t<I>>&&; // For concrete image it returns a const_reference
{ ima.at(p) } -> ::concepts::same_as<image_reference_t<I>>&&; // idem
{ ima.new_pixel(p) } -> ::concepts::same_as<image_pixel_t<I>>&&; // For concrete image pixel may propagate constness
{ ima.new_pixel_at(p) } -> ::concepts::same_as<image_pixel_t<I>>&&; // idem
#else
{ ima(p) } -> ::concepts::same_as<image_reference_t<I>>; // For concrete image it returns a const_reference
{ ima.at(p) } -> ::concepts::same_as<image_reference_t<I>>; // idem
{ ima.new_pixel(p) } -> ::concepts::same_as<image_pixel_t<I>>; // For concrete image pixel may propagate constness
{ ima.new_pixel_at(p) } -> ::concepts::same_as<image_pixel_t<I>>; // idem
#endif
};
......
......@@ -139,7 +139,7 @@ namespace mln
[[deprecated]] const T* data() const noexcept { return this->buffer(); }
index_type index_of_point(fast_point_type p) const noexcept;
fast_point_type point_at_index(index_type i) const noexcept;
point_type point_at_index(index_type i) const noexcept;
index_type delta_index(fast_point_type p) const noexcept;
/// \}
......@@ -402,7 +402,7 @@ namespace mln
template <class T, int N>
inline auto __ndbuffer_image<T, N>::point_at_index(index_type i) const noexcept -> fast_point_type
inline auto __ndbuffer_image<T, N>::point_at_index(index_type i) const noexcept -> point_type
{
fast_point_type coords;
Impl::get_point(this->__info(), i, coords.data());
......
......@@ -11,10 +11,9 @@ namespace mln
template <class Pix>
struct pixel_adaptor
{
using point_type = typename Pix::point_type;
using site_type[[deprecated]] = point_type;
using value_type = typename Pix::value_type;
using reference = typename Pix::reference;
using point_type = typename Pix::point_type;
using value_type = typename Pix::value_type;
using reference = typename Pix::reference;
decltype(auto) val() const { return m_pix.val(); }
auto point() const { return m_pix.point(); }
......@@ -79,8 +78,7 @@ namespace mln
template <class I>
struct image_adaptor_base_indexable<I, std::enable_if_t<I::indexable::value>>
{
using size_type[[deprecated]] = image_index_t<I>;
using index_type = size_type;
using index_type = image_index_t<I>;
};
template <class I, class = void>
......
......@@ -132,7 +132,7 @@ namespace mln::ranges
{
auto cursors = std::apply(
[](auto&&... cur) { return std::make_tuple(::ranges::range_access::begin_cursor(cur)...); }, m_ranges);
return {{}, cursors, m_map_fn, m_pred_fn};
return {{}, cursors, {m_map_fn}, {m_pred_fn}};
}
::ranges::default_sentinel_t end_cursor() const { return {}; }
......
......@@ -50,7 +50,7 @@ namespace mln::io
};
template <class I>
struct impl_t : impl_base_t
struct impl_t final : impl_base_t
{
impl_t(I& x) { this->m_ima = (void*)(&x); }
~impl_t() final = default;
......
......@@ -5,7 +5,7 @@
namespace mln::io::internal
{
class freeimage_reader_plugin : public plugin_reader
class freeimage_reader_plugin final : public plugin_reader
{
public:
~freeimage_reader_plugin() final;
......@@ -13,7 +13,7 @@ namespace mln::io::internal
void close() final;
};
class freeimage_writer_plugin : public plugin_writer
class freeimage_writer_plugin final : public plugin_writer
{
public:
~freeimage_writer_plugin() final;
......
......@@ -40,7 +40,8 @@ namespace mln::morpho
template <class V>
struct dilation_value_set_base
{
static inline constexpr auto sup = [](V a, V b) { return sup(a, b); };
static inline constexpr auto _sup = [](V a, V b) { return sup(a, b); };
static inline constexpr auto sup = _sup;
static inline constexpr auto zero = mln::value_traits<V>::inf();
};
......
......@@ -67,7 +67,7 @@ namespace mln::morpho::details
template <class P>
class hvectors_unbounded : public hvectors_unbounded<void>
class hvectors_unbounded final : public hvectors_unbounded<void>
{
public:
hvectors_unbounded(int nlevel);
......
......@@ -9,10 +9,17 @@
template <typename U, typename V = U>
concept AddableWith = requires(U a, V b)
{
#if __GNUC__ == 9
{ a += b } -> U&;
{ a -= b } -> U&;
{ b += a } -> V&;
{ b -= a } -> V&;
#else
{ a += b } -> ::concepts::same_as<U&>;
{ a -= b } -> ::concepts::same_as<U&>;
{ b += a } -> ::concepts::same_as<V&>;
{ b -= a } -> ::concepts::same_as<V&>;
#endif
{ a + b };
{ a - b };
{ b + a};
......
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