Skip to content

Commit

Permalink
Remove potentially expensive copy operator from idlist_t
Browse files Browse the repository at this point in the history
And fix the unnecessary copy this found.
  • Loading branch information
joto committed Mar 31, 2024
1 parent 3c1257e commit 60987b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/idlist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@ class idlist_t
using value_type = osmid_t;

idlist_t() = default;
~idlist_t() noexcept = default;

idlist_t(std::initializer_list<osmid_t> ids) : m_list(ids) {}

idlist_t(idlist_t const &) = delete;
idlist_t &operator=(idlist_t const &) = delete;

idlist_t(idlist_t &&) = default;
idlist_t &operator=(idlist_t &&) = default;

bool empty() const noexcept { return m_list.empty(); }

std::size_t size() const noexcept { return m_list.size(); }
Expand Down
2 changes: 1 addition & 1 deletion src/osmdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ void osmdata_t::process_dependents() const
}

// stage 1c processing: mark parent relations of marked objects as changed
auto marked_ways = m_output->get_marked_way_ids();
auto const &marked_ways = m_output->get_marked_way_ids();
if (marked_ways.empty()) {
return;
}
Expand Down

0 comments on commit 60987b4

Please sign in to comment.