catch and remove more spurious std::move's

This commit is contained in:
artemp 2015-06-02 14:48:02 +01:00
parent df4226a825
commit 90a27abccb
8 changed files with 54 additions and 56 deletions

View file

@ -161,7 +161,7 @@ geometry_collection<T> reproject_internal(geometry_collection<T> const & c, proj
for (auto const& g : c)
{
geometry<T> new_g(std::move(reproject_copy(g, proj_trans, n_err)));
geometry<T> new_g = reproject_copy(g, proj_trans, n_err);
if (!new_g.template is<geometry_empty>())
{
new_c.emplace_back(std::move(new_g));

View file

@ -114,7 +114,7 @@ struct geometry_transform
geometry_collection<V> collection_out;
for (auto const& geom : collection)
{
collection_out.push_back(std::move((*this)(geom)));
collection_out.push_back((*this)(geom));
}
return collection_out;
}
@ -128,37 +128,37 @@ struct geometry_transform
template <typename T>
geometry<V> operator() (point<T> const& geom) const
{
return std::move(transform_geometry<V>(geom, transformer_));
return transform_geometry<V>(geom, transformer_);
}
template <typename T>
geometry<V> operator() (line_string<T> const& geom) const
{
return std::move(transform_geometry<V>(geom, transformer_));
return transform_geometry<V>(geom, transformer_);
}
template <typename T>
geometry<V> operator() (polygon<T> const& geom) const
{
return std::move(transform_geometry<V>(geom, transformer_));
return transform_geometry<V>(geom, transformer_);
}
template <typename T>
geometry<V> operator() (multi_point<T> const& geom) const
{
return std::move(transform_geometry<V>(geom, transformer_));
return transform_geometry<V>(geom, transformer_);
}
template <typename T>
geometry<V> operator() (multi_line_string<T> const& geom) const
{
return std::move(transform_geometry<V>(geom, transformer_));
return transform_geometry<V>(geom, transformer_);
}
template <typename T>
geometry<V> operator() (multi_polygon<T> const& geom) const
{
return std::move(transform_geometry<V>(geom, transformer_));
return transform_geometry<V>(geom, transformer_);
}
Transformer const& transformer_;

View file

@ -136,12 +136,12 @@ bool freetype_engine::register_font_impl(std::string const& file_name,
auto range = font_file_mapping.equal_range(name);
if (range.first == range.second) // the key was previously absent; insert a pair
{
font_file_mapping.emplace_hint(range.first,name,std::move(std::make_pair(i,file_name)));
font_file_mapping.emplace_hint(range.first, name, std::make_pair(i,file_name));
}
else // the key was present, replace the associated value
{ /* some action with value range.first->second about to be overwritten here */
MAPNIK_LOG_WARN(font_engine_freetype) << "registering new " << name << " at '" << file_name << "'";
range.first->second = std::move(std::make_pair(i,file_name)); // replace value
range.first->second = std::make_pair(i,file_name); // replace value
}
success = true;
}
@ -340,7 +340,7 @@ face_ptr freetype_engine::create_face(std::string const& family_name,
#ifdef MAPNIK_THREADSAFE
std::lock_guard<std::mutex> lock(mutex_);
#endif
auto result = global_memory_fonts.emplace(itr->second.second, std::make_pair(std::move(file.data()),file.size()));
auto result = global_memory_fonts.emplace(itr->second.second, std::make_pair(file.data(),file.size()));
FT_Face face;
FT_Error error = FT_New_Memory_Face(library.get(),
reinterpret_cast<FT_Byte const*>(result.first->second.first.get()), // data

View file

@ -237,31 +237,31 @@ MAPNIK_DECL image_any create_image_any(int width,
switch (type)
{
case image_dtype_gray8:
return image_any(std::move(image_gray8(width, height, initialize, premultiplied, painted)));
return image_any(image_gray8(width, height, initialize, premultiplied, painted));
case image_dtype_gray8s:
return image_any(std::move(image_gray8s(width, height, initialize, premultiplied, painted)));
return image_any(image_gray8s(width, height, initialize, premultiplied, painted));
case image_dtype_gray16:
return image_any(std::move(image_gray16(width, height, initialize, premultiplied, painted)));
return image_any(image_gray16(width, height, initialize, premultiplied, painted));
case image_dtype_gray16s:
return image_any(std::move(image_gray16s(width, height, initialize, premultiplied, painted)));
return image_any(image_gray16s(width, height, initialize, premultiplied, painted));
case image_dtype_gray32:
return image_any(std::move(image_gray32(width, height, initialize, premultiplied, painted)));
return image_any(image_gray32(width, height, initialize, premultiplied, painted));
case image_dtype_gray32s:
return image_any(std::move(image_gray32s(width, height, initialize, premultiplied, painted)));
return image_any(image_gray32s(width, height, initialize, premultiplied, painted));
case image_dtype_gray32f:
return image_any(std::move(image_gray32f(width, height, initialize, premultiplied, painted)));
return image_any(image_gray32f(width, height, initialize, premultiplied, painted));
case image_dtype_gray64:
return image_any(std::move(image_gray64(width, height, initialize, premultiplied, painted)));
return image_any(image_gray64(width, height, initialize, premultiplied, painted));
case image_dtype_gray64s:
return image_any(std::move(image_gray64s(width, height, initialize, premultiplied, painted)));
return image_any(image_gray64s(width, height, initialize, premultiplied, painted));
case image_dtype_gray64f:
return image_any(std::move(image_gray64f(width, height, initialize, premultiplied, painted)));
return image_any(image_gray64f(width, height, initialize, premultiplied, painted));
case image_dtype_null:
return image_any(std::move(image_null()));
return image_any(image_null());
case image_dtype_rgba8:
case IMAGE_DTYPE_MAX:
default:
return image_any(std::move(image_rgba8(width, height, initialize, premultiplied, painted)));
return image_any(image_rgba8(width, height, initialize, premultiplied, painted));
}
}

View file

@ -186,12 +186,12 @@ std::shared_ptr<mapnik::marker const> marker_cache::find(std::string const& uri,
marker_path->set_dimensions(svg.width(),svg.height());
if (update_cache)
{
auto emplace_result = marker_cache_.emplace(uri,std::make_shared<mapnik::marker const>(std::move(mapnik::marker_svg(marker_path))));
auto emplace_result = marker_cache_.emplace(uri,std::make_shared<mapnik::marker const>(mapnik::marker_svg(marker_path)));
return emplace_result.first->second;
}
else
{
return std::make_shared<mapnik::marker const>(std::move(mapnik::marker_svg(marker_path)));
return std::make_shared<mapnik::marker const>(mapnik::marker_svg(marker_path));
}
}
// otherwise assume file-based
@ -218,12 +218,12 @@ std::shared_ptr<mapnik::marker const> marker_cache::find(std::string const& uri,
marker_path->set_dimensions(svg.width(),svg.height());
if (update_cache)
{
auto emplace_result = marker_cache_.emplace(uri,std::make_shared<mapnik::marker const>(std::move(mapnik::marker_svg(marker_path))));
auto emplace_result = marker_cache_.emplace(uri,std::make_shared<mapnik::marker const>(mapnik::marker_svg(marker_path)));
return emplace_result.first->second;
}
else
{
return std::make_shared<mapnik::marker const>(std::move(mapnik::marker_svg(marker_path)));
return std::make_shared<mapnik::marker const>(mapnik::marker_svg(marker_path));
}
}
else
@ -240,14 +240,14 @@ std::shared_ptr<mapnik::marker const> marker_cache::find(std::string const& uri,
{
auto emplace_result = marker_cache_.emplace(uri,
std::make_shared<mapnik::marker const>(
std::move(util::apply_visitor(detail::visitor_create_marker(), im))
util::apply_visitor(detail::visitor_create_marker(), im)
));
return emplace_result.first->second;
}
else
{
return std::make_shared<mapnik::marker const>(
std::move(util::apply_visitor(detail::visitor_create_marker(), im))
util::apply_visitor(detail::visitor_create_marker(), im)
);
}
}

View file

@ -20,7 +20,7 @@ SECTION("envelope_test - double") {
}
{
// Test empty geom
geometry<double> geom(std::move(mapnik::geometry::geometry_empty()));
geometry<double> geom = mapnik::geometry::geometry_empty();
mapnik::box2d<double> bbox = mapnik::geometry::envelope(geom);
REQUIRE_FALSE( bbox.valid() );
}

View file

@ -45,7 +45,7 @@ SECTION("test_projection_4326_3857 - Empty Geometry in Geometry Variant") {
mapnik::projection dest("+init=epsg:3857");
mapnik::proj_transform proj_trans(source, dest);
{
geometry<double> geom(std::move(geometry_empty()));
geometry<double> geom = geometry_empty();
unsigned int err = 0;
// Test Standard Transform
geometry<double> new_geom = reproject_copy(geom, proj_trans, err);

View file

@ -62,7 +62,7 @@ SECTION("proj and view strategy") {
// Test that both work grouped together passing in geometry
using sg_type = strategy_group<mapnik::proj_strategy, mapnik::view_strategy >;
sg_type sg(ps, vs);
geometry<double> p1(std::move(point<double>(-97.553098,35.523105)));
geometry<double> p1(point<double>(-97.553098,35.523105));
point<double> r1(58.6287 , 100.945);
geometry<double> p2 = transform<double>(p1, sg);
REQUIRE(p2.is<point<double> >());
@ -73,7 +73,7 @@ SECTION("proj and view strategy") {
// Test that it works pulling back int
using sg_type = strategy_group<mapnik::proj_strategy, mapnik::view_strategy >;
sg_type sg(ps, vs);
geometry<double> p1(std::move(point<double>(-97.553098,35.523105)));
geometry<double> p1(point<double>(-97.553098,35.523105));
point<std::int64_t> r1(58 , 100);
geometry<std::int64_t> p2 = transform<std::int64_t>(p1, sg);
REQUIRE(p2.is<point<std::int64_t> >());
@ -85,7 +85,7 @@ SECTION("proj and view strategy") {
mapnik::geometry::scale_rounding_strategy ss(16);
using sg_type = strategy_group<mapnik::proj_strategy, mapnik::view_strategy, mapnik::geometry::scale_rounding_strategy >;
sg_type sg(ps, vs, ss);
geometry<double> p1(std::move(point<double>(-97.553098,35.523105)));
geometry<double> p1(point<double>(-97.553098,35.523105));
point<std::int64_t> r1(938 , 1615);
geometry<std::int64_t> p2 = transform<std::int64_t>(p1, sg);
REQUIRE(p2.is<point<std::int64_t> >());
@ -97,7 +97,7 @@ SECTION("proj and view strategy") {
mapnik::geometry::scale_strategy ss(1.0/16.0);
using sg_type = strategy_group_first<mapnik::geometry::scale_strategy, mapnik::unview_strategy, mapnik::proj_strategy >;
sg_type sg(ss, uvs, ps_rev);
geometry<std::int64_t> p1(std::move(point<std::int64_t>(938 , 1615)));
geometry<std::int64_t> p1(point<std::int64_t>(938 , 1615));
point<double> r1(-97.5586 , 35.5322);
geometry<double> p2 = transform<double>(p1, sg);
REQUIRE(p2.is<point<double> >());
@ -109,7 +109,7 @@ SECTION("proj and view strategy") {
mapnik::geometry::scale_rounding_strategy ss(16, 20);
using sg_type = strategy_group<mapnik::proj_strategy, mapnik::view_strategy, mapnik::geometry::scale_rounding_strategy >;
sg_type sg(ps, vs, ss);
geometry<double> p1(std::move(point<double>(-97.553098,35.523105)));
geometry<double> p1(point<double>(-97.553098,35.523105));
point<std::int64_t> r1(958 , 1635);
geometry<std::int64_t> p2 = transform<std::int64_t>(p1, sg);
REQUIRE(p2.is<point<std::int64_t> >());
@ -121,7 +121,7 @@ SECTION("proj and view strategy") {
mapnik::geometry::scale_strategy ss(1.0/16.0, -20.0/16.0);
using sg_type = strategy_group_first<mapnik::geometry::scale_strategy, mapnik::unview_strategy, mapnik::proj_strategy >;
sg_type sg(ss, uvs, ps_rev);
geometry<std::int64_t> p1(std::move(point<std::int64_t>(958 , 1635)));
geometry<std::int64_t> p1(point<std::int64_t>(958 , 1635));
point<double> r1(-97.5586 , 35.5322);
geometry<double> p2 = transform<double>(p1, sg);
REQUIRE(p2.is<point<double> >());
@ -185,5 +185,3 @@ SECTION("scaling strategies - double to int64") {
} // END SECTION
} // END TEST CASE