Merge pull request #2286 from joakim-hove/well-get-index-forward

Use template predicate and perfect forwarding
This commit is contained in:
Joakim Hove
2021-02-10 15:37:50 +01:00
committed by GitHub

View File

@@ -150,8 +150,9 @@ namespace Opm {
}
const T* find(const std::function<bool(const std::pair<K,std::shared_ptr<T>>&)>& predicate) const {
auto iter = std::find_if( this->m_data.begin(), this->m_data.end(), predicate);
template <typename Predicate>
const T* find(Predicate&& predicate) const {
auto iter = std::find_if( this->m_data.begin(), this->m_data.end(), std::forward<Predicate>(predicate));
if (iter == this->m_data.end())
return nullptr;