Use ptr not ref for mutable param in expire_tiles::merge_and_destroy
parent
3595c6435c
commit
7a20db8e4f
|
@ -278,19 +278,19 @@ int expire_tiles::from_result(pg_result_t const &result, osmid_t osm_id)
|
|||
return num_tuples;
|
||||
}
|
||||
|
||||
void expire_tiles::merge_and_destroy(expire_tiles &other)
|
||||
void expire_tiles::merge_and_destroy(expire_tiles *other)
|
||||
{
|
||||
if (m_map_width != other.m_map_width) {
|
||||
if (m_map_width != other->m_map_width) {
|
||||
throw std::runtime_error{"Unable to merge tile expiry sets when "
|
||||
"map_width does not match: {} != {}."_format(
|
||||
m_map_width, other.m_map_width)};
|
||||
m_map_width, other->m_map_width)};
|
||||
}
|
||||
|
||||
if (m_dirty_tiles.empty()) {
|
||||
m_dirty_tiles = std::move(other.m_dirty_tiles);
|
||||
m_dirty_tiles = std::move(other->m_dirty_tiles);
|
||||
} else {
|
||||
m_dirty_tiles.insert(other.m_dirty_tiles.begin(),
|
||||
other.m_dirty_tiles.end());
|
||||
other.m_dirty_tiles.clear();
|
||||
m_dirty_tiles.insert(other->m_dirty_tiles.begin(),
|
||||
other->m_dirty_tiles.end());
|
||||
other->m_dirty_tiles.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
* merge the list of expired tiles in the other object into this
|
||||
* object, destroying the list in the other object.
|
||||
*/
|
||||
void merge_and_destroy(expire_tiles &other);
|
||||
void merge_and_destroy(expire_tiles *other);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -1802,6 +1802,6 @@ void output_flex_t::merge_expire_trees(output_t *other)
|
|||
{
|
||||
auto *opgsql = dynamic_cast<output_flex_t *>(other);
|
||||
if (opgsql) {
|
||||
m_expire.merge_and_destroy(opgsql->m_expire);
|
||||
m_expire.merge_and_destroy(&opgsql->m_expire);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -494,6 +494,6 @@ void output_pgsql_t::merge_expire_trees(output_t *other)
|
|||
{
|
||||
auto *const opgsql = dynamic_cast<output_pgsql_t *>(other);
|
||||
if (opgsql) {
|
||||
m_expire.merge_and_destroy(opgsql->m_expire);
|
||||
m_expire.merge_and_destroy(&opgsql->m_expire);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -231,8 +231,8 @@ TEST_CASE("merge expire sets", "[NoDB]")
|
|||
auto check_set2 = tile_output_set::generate_random(zoom, 100);
|
||||
check_set2.expire_centroids(&et2);
|
||||
|
||||
et.merge_and_destroy(et1);
|
||||
et.merge_and_destroy(et2);
|
||||
et.merge_and_destroy(&et1);
|
||||
et.merge_and_destroy(&et2);
|
||||
|
||||
tile_output_set check_set;
|
||||
check_set += check_set1;
|
||||
|
@ -263,8 +263,8 @@ TEST_CASE("merge identical expire sets", "[NoDB]")
|
|||
check_set.expire_centroids(&et1);
|
||||
check_set.expire_centroids(&et2);
|
||||
|
||||
et.merge_and_destroy(et1);
|
||||
et.merge_and_destroy(et2);
|
||||
et.merge_and_destroy(&et1);
|
||||
et.merge_and_destroy(&et2);
|
||||
|
||||
tile_output_set set;
|
||||
et.output_and_destroy(set, zoom);
|
||||
|
@ -295,8 +295,8 @@ TEST_CASE("merge overlapping expire sets", "[NoDB]")
|
|||
check_set3.expire_centroids(&et1);
|
||||
check_set3.expire_centroids(&et2);
|
||||
|
||||
et.merge_and_destroy(et1);
|
||||
et.merge_and_destroy(et2);
|
||||
et.merge_and_destroy(&et1);
|
||||
et.merge_and_destroy(&et2);
|
||||
|
||||
tile_output_set check_set;
|
||||
check_set += check_set1;
|
||||
|
@ -328,8 +328,8 @@ TEST_CASE("merge with complete flag", "[NoDB]")
|
|||
et1.from_bbox({-10000, -10000, 0, 10000});
|
||||
et2.from_bbox({0, -10000, 10000, 10000});
|
||||
|
||||
et.merge_and_destroy(et1);
|
||||
et.merge_and_destroy(et2);
|
||||
et.merge_and_destroy(&et1);
|
||||
et.merge_and_destroy(&et2);
|
||||
|
||||
tile_output_set set;
|
||||
et.output_and_destroy(set, zoom);
|
||||
|
|
Loading…
Reference in New Issue