summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-06-07 16:04:03 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-06-07 16:45:12 +0300
commit4294b0f83a6894cd6a1679c7fb427eefeac5a7a6 (patch)
tree2dfe74d81d740a81937052b1763f58e9f64d2233 /include
parent680fcd09b145b56dd6112eb9be901e5b558ab94d (diff)
downloadqtlocation-mapboxgl-4294b0f83a6894cd6a1679c7fb427eefeac5a7a6.tar.gz
[core] mbgl::Image is now movable, noncopyable
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/util/image.hpp16
1 files changed, 15 insertions, 1 deletions
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 <mbgl/util/noncopyable.hpp>
+
#include <string>
#include <memory>
#include <algorithm>
@@ -12,7 +14,7 @@ enum ImageAlphaMode {
};
template <ImageAlphaMode Mode>
-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(),