Config: remove string and const char* overloads for operator[]

Since these just construct a string_view from their arguments, we can just let the implicit conversion happen.
This commit is contained in:
Charles Dang 2024-09-14 16:24:04 -04:00
parent c34a18da47
commit 7332e124eb
2 changed files with 1 additions and 37 deletions

View file

@ -477,42 +477,6 @@ public:
*/
const attribute_value& operator[](config_key_type key) const;
/**
* Returns a reference to the attribute with the given @a key.
* Creates it if it does not exist.
*/
attribute_value& operator[](const std::string& key)
{
return operator[](config_key_type(key));
}
/**
* Returns a reference to the attribute with the given @a key
* or to a dummy empty attribute if it does not exist.
*/
const attribute_value& operator[](const std::string& key) const
{
return operator[](config_key_type(key));
}
/**
* Returns a reference to the attribute with the given @a key.
* Creates it if it does not exist.
*/
attribute_value& operator[](const char* key)
{
return operator[](config_key_type(key));
}
/**
* Returns a reference to the attribute with the given @a key
* or to a dummy empty attribute if it does not exist.
*/
const attribute_value& operator[](const char* key) const
{
return operator[](config_key_type(key));
}
/**
* Returns a pointer to the attribute with the given @a key
* or nullptr if it does not exist.

View file

@ -40,7 +40,7 @@ mp_options_helper::mp_options_helper(window& window, ng::create_engine& create_e
{
for(const auto c : prefs::get().options().all_children_range()) {
for(const auto& saved_option : c.cfg.child_range("option")) {
options_data_[c.cfg["id"]][saved_option["id"]] = saved_option["value"];
options_data_[c.cfg["id"]][saved_option["id"].str()] = saved_option["value"];
}
}