OptionDescs are const in OptionRegistry

This commit is contained in:
Maxime Coste 2016-09-26 22:59:02 +01:00
parent 5e3effc1f0
commit a0c20a924a
2 changed files with 3 additions and 3 deletions

View File

@ -115,7 +115,7 @@ void OptionManager::on_option_changed(const Option& option)
CandidateList OptionsRegistry::complete_option_name(StringView prefix,
ByteCount cursor_pos) const
{
using OptionPtr = std::unique_ptr<OptionDesc>;
using OptionPtr = std::unique_ptr<const OptionDesc>;
return complete(prefix, cursor_pos, m_descs |
filter([](const OptionPtr& desc)
{ return not (desc->flags() & OptionFlags::Hidden); }) |

View File

@ -234,7 +234,7 @@ public:
const OptionDesc* option_desc(StringView name) const
{
auto it = find_if(m_descs,
[&name](const std::unique_ptr<OptionDesc>& opt)
[&name](const std::unique_ptr<const OptionDesc>& opt)
{ return opt->name() == name; });
return it != m_descs.end() ? it->get() : nullptr;
}
@ -244,7 +244,7 @@ public:
CandidateList complete_option_name(StringView prefix, ByteCount cursor_pos) const;
private:
OptionManager& m_global_manager;
Vector<std::unique_ptr<OptionDesc>, MemoryDomain::Options> m_descs;
Vector<std::unique_ptr<const OptionDesc>, MemoryDomain::Options> m_descs;
};
}