mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-26 02:40:43 -06:00
Fix incorrect use of remove_if()
- spotted by clang-tidy bugprone - probably no visible effects because of uniqueness, and other checks libgnucash/engine/gnc-optiondb.cpp:149:5: warning: this call will remove at most one item even when multiple items should be removed [bugprone-inaccurate-erase] m_options.erase(std::remove_if(m_options.begin(), m_options.end(), ^ libgnucash/engine/gnc-optiondb.cpp:358:5: warning: the value returned by this function should be used [bugprone-unused-return-value] std::remove_if(m_callbacks.begin(), m_callbacks.end(), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ libgnucash/engine/gnc-optiondb.cpp:358:5: note: cast the expression to void to silence this warning
This commit is contained in:
parent
144b6ae090
commit
b5f3f99035
@ -150,7 +150,7 @@ GncOptionSection::remove_option(const char* name)
|
||||
[name](const auto& option) -> bool
|
||||
{
|
||||
return option.get_name() == name;
|
||||
}));
|
||||
}), m_options.end());
|
||||
}
|
||||
|
||||
const GncOption*
|
||||
@ -355,8 +355,9 @@ GncOptionDB::register_callback(GncOptionDBChangeCallback cb, void* data)
|
||||
void
|
||||
GncOptionDB::unregister_callback(size_t id)
|
||||
{
|
||||
std::remove_if(m_callbacks.begin(), m_callbacks.end(),
|
||||
[id](auto& cb)->bool { return cb.m_id == id; });
|
||||
m_callbacks.erase(std::remove_if(m_callbacks.begin(), m_callbacks.end(),
|
||||
[id](auto& cb)->bool { return cb.m_id == id; }),
|
||||
m_callbacks.end());
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user