From f8010f0ba1e81bb06e2e05068c4f208655f367ab Mon Sep 17 00:00:00 2001 From: Blake Thompson Date: Thu, 19 Mar 2015 14:58:01 -0500 Subject: [PATCH] Updated image_view any with < and == operators, removed default constructor from image_view and image_view_any --- include/mapnik/image_view.hpp | 6 ++++-- include/mapnik/image_view_any.hpp | 2 +- include/mapnik/image_view_impl.hpp | 12 ++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/mapnik/image_view.hpp b/include/mapnik/image_view.hpp index f9d13977f..eb4eac6e7 100644 --- a/include/mapnik/image_view.hpp +++ b/include/mapnik/image_view.hpp @@ -35,12 +35,14 @@ public: using pixel_type = typename T::pixel_type; static const image_dtype dtype = T::dtype; static constexpr std::size_t pixel_size = sizeof(pixel_type); - + image_view() = delete; image_view(unsigned x, unsigned y, unsigned width, unsigned height, T const& data); ~image_view(); - + image_view(image_view const& rhs); image_view & operator=(image_view const& rhs); + bool operator==(image_view const& rhs) const; + bool operator<(image_view const& rhs) const; unsigned x() const; unsigned y() const; diff --git a/include/mapnik/image_view_any.hpp b/include/mapnik/image_view_any.hpp index 7281d8550..3381f90c1 100644 --- a/include/mapnik/image_view_any.hpp +++ b/include/mapnik/image_view_any.hpp @@ -42,7 +42,7 @@ using image_view_base = util::variant image_view_any(T && data) noexcept diff --git a/include/mapnik/image_view_impl.hpp b/include/mapnik/image_view_impl.hpp index 7c46ab63f..e71176d90 100644 --- a/include/mapnik/image_view_impl.hpp +++ b/include/mapnik/image_view_impl.hpp @@ -62,6 +62,18 @@ image_view & image_view::operator=(image_view const& rhs) return *this; } +template +bool image_view::operator==(image_view const& rhs) const +{ + return rhs.data_.getBytes() == data_.getBytes(); +} + +template +bool image_view::operator<(image_view const& rhs) const +{ + return data_.getSize() < rhs.data_.getSize(); +} + template inline unsigned image_view::x() const {