From 870067360f8195cadf2e1953ac20a56a44377f9f Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Tue, 9 May 2017 10:50:04 +0300 Subject: [tidy] modernize-pass-by-value --- include/mbgl/util/range.hpp | 6 ++++-- src/mbgl/map/map.cpp | 7 ++++--- src/mbgl/programs/binary_program.cpp | 5 +++-- src/mbgl/programs/binary_program.hpp | 2 +- src/mbgl/programs/program_parameters.hpp | 5 +++-- test/util/merge_lines.test.cpp | 7 ++++--- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/include/mbgl/util/range.hpp b/include/mbgl/util/range.hpp index f7fa92eb8b..5591a22a1f 100644 --- a/include/mbgl/util/range.hpp +++ b/include/mbgl/util/range.hpp @@ -1,3 +1,5 @@ +#include + #pragma once namespace mbgl { @@ -5,8 +7,8 @@ namespace mbgl { template class Range { public: - constexpr Range(const T& min_, const T& max_) - : min(min_), max(max_) {} + constexpr Range(T min_, T max_) + : min(std::move(min_)), max(std::move(max_)) {} T min; T max; diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 52ac323df4..c7daf5ac09 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -27,6 +27,7 @@ #include #include #include +#include namespace mbgl { @@ -58,7 +59,7 @@ public: GLContextMode, ConstrainMode, ViewportMode, - const std::string& programCacheDir); + std::string programCacheDir); void onSourceChanged(style::Source&) override; void onUpdate(Update) override; @@ -139,7 +140,7 @@ Map::Impl::Impl(Map& map_, GLContextMode contextMode_, ConstrainMode constrainMode_, ViewportMode viewportMode_, - const std::string& programCacheDir_) + std::string programCacheDir_) : map(map_), observer(backend_), backend(backend_), @@ -151,7 +152,7 @@ Map::Impl::Impl(Map& map_, mode(mode_), contextMode(contextMode_), pixelRatio(pixelRatio_), - programCacheDir(programCacheDir_), + programCacheDir(std::move(programCacheDir_)), annotationManager(std::make_unique(pixelRatio)), asyncInvalidate([this] { if (mode == MapMode::Continuous) { diff --git a/src/mbgl/programs/binary_program.cpp b/src/mbgl/programs/binary_program.cpp index 3b37cfa442..09b9acc514 100644 --- a/src/mbgl/programs/binary_program.cpp +++ b/src/mbgl/programs/binary_program.cpp @@ -2,6 +2,7 @@ #include #include +#include template static std::pair parseBinding(protozero::pbf_reader&& pbf) { @@ -64,12 +65,12 @@ BinaryProgram::BinaryProgram(std::string&& data) { BinaryProgram::BinaryProgram( gl::BinaryProgramFormat binaryFormat_, std::string&& binaryCode_, - const std::string& binaryIdentifier_, + std::string binaryIdentifier_, std::vector>&& attributes_, std::vector>&& uniforms_) : binaryFormat(binaryFormat_), binaryCode(std::move(binaryCode_)), - binaryIdentifier(binaryIdentifier_), + binaryIdentifier(std::move(binaryIdentifier_)), attributes(std::move(attributes_)), uniforms(std::move(uniforms_)) { } diff --git a/src/mbgl/programs/binary_program.hpp b/src/mbgl/programs/binary_program.hpp index 8ff3863dc1..b77cf1a510 100644 --- a/src/mbgl/programs/binary_program.hpp +++ b/src/mbgl/programs/binary_program.hpp @@ -14,7 +14,7 @@ public: BinaryProgram(gl::BinaryProgramFormat, std::string&& binaryCode, - const std::string& binaryIdentifier, + std::string binaryIdentifier, std::vector>&&, std::vector>&&); diff --git a/src/mbgl/programs/program_parameters.hpp b/src/mbgl/programs/program_parameters.hpp index b91b41f358..e427963f81 100644 --- a/src/mbgl/programs/program_parameters.hpp +++ b/src/mbgl/programs/program_parameters.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include namespace mbgl { @@ -8,8 +9,8 @@ class ProgramParameters { public: ProgramParameters(float pixelRatio_ = 1.0, bool overdraw_ = false, - const std::string& cacheDir_ = "") - : pixelRatio(pixelRatio_), overdraw(overdraw_), cacheDir(cacheDir_) { + std::string cacheDir_ = "") + : pixelRatio(pixelRatio_), overdraw(overdraw_), cacheDir(std::move(cacheDir_)) { } const float pixelRatio; diff --git a/test/util/merge_lines.test.cpp b/test/util/merge_lines.test.cpp index 8a3a400887..6c8387c451 100644 --- a/test/util/merge_lines.test.cpp +++ b/test/util/merge_lines.test.cpp @@ -2,6 +2,7 @@ #include #include +#include const std::u16string aaa = u"a"; const std::u16string bbb = u"b"; @@ -12,10 +13,10 @@ class GeometryTileFeatureStub : public GeometryTileFeature { public: GeometryTileFeatureStub(optional id_, FeatureType type_, GeometryCollection geometry_, std::unordered_map properties_) : - id(id_), + id(std::move(id_)), type(type_), - geometry(geometry_), - properties(properties_) + geometry(std::move(geometry_)), + properties(std::move(properties_)) {} FeatureType getType() const override { return type; } -- cgit v1.2.1