From 4294b0f83a6894cd6a1679c7fb427eefeac5a7a6 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Tue, 7 Jun 2016 16:04:03 +0300 Subject: [core] mbgl::Image is now movable, noncopyable --- include/mbgl/util/image.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'include/mbgl/util') diff --git a/include/mbgl/util/image.hpp b/include/mbgl/util/image.hpp index fbb0686a7b..124cdca7cd 100644 --- a/include/mbgl/util/image.hpp +++ b/include/mbgl/util/image.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include #include #include @@ -12,7 +14,7 @@ enum ImageAlphaMode { }; template -class Image { +class Image : private util::noncopyable { public: Image() = default; @@ -26,6 +28,18 @@ public: height(h), data(std::move(data_)) {} + Image(Image&& o) + : width(o.width), + height(o.height), + data(std::move(o.data)) {} + + Image& operator=(Image&& o) { + width = o.width; + height = o.height; + data = std::move(o.data); + return *this; + } + bool operator==(const Image& rhs) const { return width == rhs.width && height == rhs.height && std::equal(data.get(), data.get() + size(), rhs.data.get(), -- cgit v1.2.1