diff --git a/src/idvaluemap.hh b/src/idvaluemap.hh index 7f7dc7de..387e6fb0 100644 --- a/src/idvaluemap.hh +++ b/src/idvaluemap.hh @@ -63,14 +63,19 @@ public: } } - template - CandidateList complete_id(const std::string& prefix, - size_t cursor_pos) + template + CandidateList complete_id_if(const std::string& prefix, + size_t cursor_pos, + _Condition condition) { std::string real_prefix = prefix.substr(0, cursor_pos); CandidateList result; for (auto& value : m_content) { + if (not condition(value)) + continue; + std::string id_str = id_to_string(value.first); if (id_str.substr(0, real_prefix.length()) == real_prefix) result.push_back(std::move(id_str)); @@ -78,6 +83,14 @@ public: return result; } + template + CandidateList complete_id(const std::string& prefix, + size_t cursor_pos) + { + return complete_id_if( + prefix, cursor_pos, [](const value_type&) { return true; }); + } + iterator begin() { return m_content.begin(); } iterator end() { return m_content.end(); } const_iterator begin() const { return m_content.begin(); }