From 478472e501a6aa579174f547277176c19104deb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 1 Dec 2015 17:45:21 +0100 Subject: [core] add std::move to constructors --- include/mbgl/util/run_loop.hpp | 2 +- platform/default/headless_view.cpp | 3 ++- src/mbgl/annotation/annotation_tile.cpp | 3 ++- src/mbgl/map/tile_worker.cpp | 3 ++- src/mbgl/map/vector_tile.cpp | 3 ++- src/mbgl/storage/request_base.hpp | 3 ++- src/mbgl/style/layout_property.hpp | 3 ++- src/mbgl/style/paint_property.hpp | 3 ++- src/mbgl/text/glyph.hpp | 3 ++- src/mbgl/util/work_request.cpp | 3 ++- test/sprite/sprite_store.cpp | 3 ++- test/style/glyph_store.cpp | 3 ++- 12 files changed, 23 insertions(+), 12 deletions(-) diff --git a/include/mbgl/util/run_loop.hpp b/include/mbgl/util/run_loop.hpp index 3cf92f56d0..fef00743f7 100644 --- a/include/mbgl/util/run_loop.hpp +++ b/include/mbgl/util/run_loop.hpp @@ -114,7 +114,7 @@ private: class Invoker : public WorkTask { public: Invoker(F&& f, P&& p, std::shared_ptr> canceled_ = nullptr) - : canceled(canceled_), + : canceled(std::move(canceled_)), func(std::move(f)), params(std::move(p)) { } diff --git a/platform/default/headless_view.cpp b/platform/default/headless_view.cpp index 3eaa4949b6..55a8c57773 100644 --- a/platform/default/headless_view.cpp +++ b/platform/default/headless_view.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #ifdef MBGL_USE_CGL #include @@ -26,7 +27,7 @@ HeadlessView::HeadlessView(std::shared_ptr display_, float pixelRatio_, uint16_t width, uint16_t height) - : display(display_), pixelRatio(pixelRatio_) { + : display(std::move(display_)), pixelRatio(pixelRatio_) { resize(width, height); } diff --git a/src/mbgl/annotation/annotation_tile.cpp b/src/mbgl/annotation/annotation_tile.cpp index 4a342c7e10..f3897ad3ea 100644 --- a/src/mbgl/annotation/annotation_tile.cpp +++ b/src/mbgl/annotation/annotation_tile.cpp @@ -2,13 +2,14 @@ #include #include #include +#include namespace mbgl { AnnotationTileFeature::AnnotationTileFeature(FeatureType type_, GeometryCollection geometries_, std::unordered_map properties_) : type(type_), - properties(properties_), + properties(std::move(properties_)), geometries(geometries_) {} mapbox::util::optional AnnotationTileFeature::getValue(const std::string& key) const { diff --git a/src/mbgl/map/tile_worker.cpp b/src/mbgl/map/tile_worker.cpp index 932bc0f689..177e8cdd71 100644 --- a/src/mbgl/map/tile_worker.cpp +++ b/src/mbgl/map/tile_worker.cpp @@ -9,6 +9,7 @@ #include #include #include +#include using namespace mbgl; @@ -19,7 +20,7 @@ TileWorker::TileWorker(TileID id_, GlyphStore& glyphStore_, const std::atomic& state_) : id(id_), - sourceID(sourceID_), + sourceID(std::move(sourceID_)), spriteStore(spriteStore_), glyphAtlas(glyphAtlas_), glyphStore(glyphStore_), diff --git a/src/mbgl/map/vector_tile.cpp b/src/mbgl/map/vector_tile.cpp index f18c3f6821..00307f04a9 100644 --- a/src/mbgl/map/vector_tile.cpp +++ b/src/mbgl/map/vector_tile.cpp @@ -6,6 +6,7 @@ #include #include +#include namespace mbgl { @@ -130,7 +131,7 @@ GeometryCollection VectorTileFeature::getGeometries() const { } VectorTile::VectorTile(std::shared_ptr data_) - : data(data_) { + : data(std::move(data_)) { } util::ptr VectorTile::getLayer(const std::string& name) const { diff --git a/src/mbgl/storage/request_base.hpp b/src/mbgl/storage/request_base.hpp index 0f3e257ad1..5e99041cd4 100644 --- a/src/mbgl/storage/request_base.hpp +++ b/src/mbgl/storage/request_base.hpp @@ -7,6 +7,7 @@ #include #include +#include namespace mbgl { @@ -18,7 +19,7 @@ public: RequestBase(const Resource& resource_, Callback notify_) : resource(resource_) - , notify(notify_) { + , notify(std::move(notify_)) { } virtual ~RequestBase() = default; diff --git a/src/mbgl/style/layout_property.hpp b/src/mbgl/style/layout_property.hpp index 7feb931204..db2b2d3aba 100644 --- a/src/mbgl/style/layout_property.hpp +++ b/src/mbgl/style/layout_property.hpp @@ -3,6 +3,7 @@ #include #include +#include #include @@ -13,7 +14,7 @@ using JSVal = rapidjson::Value; template class LayoutProperty { public: - LayoutProperty(T v) : value(v) {} + LayoutProperty(T v) : value(std::move(v)) {} void parse(const char * name, const JSVal& layout) { if (layout.HasMember(name)) { diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp index 88feb1307b..710ce34a4f 100644 --- a/src/mbgl/style/paint_property.hpp +++ b/src/mbgl/style/paint_property.hpp @@ -12,6 +12,7 @@ #include #include +#include namespace mbgl { @@ -117,7 +118,7 @@ public: : prior(std::move(prior_)), begin(begin_), end(end_), - value(value_) { + value(std::move(value_)) { } Result calculate(const StyleCalculationParameters& parameters) { diff --git a/src/mbgl/text/glyph.hpp b/src/mbgl/text/glyph.hpp index d1ba71c767..62949ee3fd 100644 --- a/src/mbgl/text/glyph.hpp +++ b/src/mbgl/text/glyph.hpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -59,7 +60,7 @@ class Shaping { public: inline explicit Shaping() : top(0), bottom(0), left(0), right(0) {} inline explicit Shaping(float x, float y, std::u32string text_) - : text(text_), top(y), bottom(y), left(x), right(x) {} + : text(std::move(text_)), top(y), bottom(y), left(x), right(x) {} std::vector positionedGlyphs; std::u32string text; int32_t top; diff --git a/src/mbgl/util/work_request.cpp b/src/mbgl/util/work_request.cpp index 819585ae56..eb84df7bf2 100644 --- a/src/mbgl/util/work_request.cpp +++ b/src/mbgl/util/work_request.cpp @@ -2,10 +2,11 @@ #include #include +#include namespace mbgl { -WorkRequest::WorkRequest(Task task_) : task(task_) { +WorkRequest::WorkRequest(Task task_) : task(std::move(task_)) { assert(task); } diff --git a/test/sprite/sprite_store.cpp b/test/sprite/sprite_store.cpp index fd8f3616f5..574af51b81 100644 --- a/test/sprite/sprite_store.cpp +++ b/test/sprite/sprite_store.cpp @@ -7,6 +7,7 @@ #include #include #include +#include using namespace mbgl; @@ -156,7 +157,7 @@ struct SpriteParams { class SpriteThread : public SpriteStore::Observer { public: - SpriteThread(FileSource* fileSource, SpriteTestCallback callback) : callback_(callback) { + SpriteThread(FileSource* fileSource, SpriteTestCallback callback) : callback_(std::move(callback)) { util::ThreadContext::setFileSource(fileSource); } diff --git a/test/style/glyph_store.cpp b/test/style/glyph_store.cpp index 8d7c2aeefa..4524716212 100644 --- a/test/style/glyph_store.cpp +++ b/test/style/glyph_store.cpp @@ -7,6 +7,7 @@ #include #include #include +#include using namespace mbgl; @@ -20,7 +21,7 @@ struct GlyphStoreParams { class GlyphStoreThread : public GlyphStore::Observer { public: - GlyphStoreThread(FileSource* fileSource, GlyphStoreTestCallback callback) : callback_(callback) { + GlyphStoreThread(FileSource* fileSource, GlyphStoreTestCallback callback) : callback_(std::move(callback)) { util::ThreadContext::setFileSource(fileSource); } -- cgit v1.2.1