mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-01-10 01:20:06 +00:00
refactor: use std::map::at instead of []
This commit is contained in:
parent
483a39beb4
commit
a1095f3e4c
@ -768,7 +768,7 @@ find_or(basic_value<C, M, V>& v, const toml::key& ky, basic_value<C, M, V>& opt)
|
||||
if(!v.is_table()) {return opt;}
|
||||
auto& tab = v.as_table();
|
||||
if(tab.count(ky) == 0) {return opt;}
|
||||
return tab[ky];
|
||||
return tab.at(ky);
|
||||
}
|
||||
|
||||
template<typename C,
|
||||
@ -779,7 +779,7 @@ find_or(basic_value<C, M, V>&& v, const toml::key& ky, basic_value<C, M, V>&& op
|
||||
if(!v.is_table()) {return opt;}
|
||||
auto tab = std::move(v).as_table();
|
||||
if(tab.count(ky) == 0) {return opt;}
|
||||
return std::move(tab[ky]);
|
||||
return std::move(tab.at(ky));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -805,7 +805,7 @@ find_or(basic_value<C, M, V>& v, const toml::key& ky, T& opt)
|
||||
if(!v.is_table()) {return opt;}
|
||||
auto& tab = v.as_table();
|
||||
if(tab.count(ky) == 0) {return opt;}
|
||||
return get_or(tab[ky], opt);
|
||||
return get_or(tab.at(ky), opt);
|
||||
}
|
||||
|
||||
template<typename T, typename C,
|
||||
@ -817,7 +817,7 @@ find_or(basic_value<C, M, V>&& v, const toml::key& ky, T&& opt)
|
||||
if(!v.is_table()) {return opt;}
|
||||
auto tab = std::move(v).as_table();
|
||||
if(tab.count(ky) == 0) {return opt;}
|
||||
return get_or(std::move(tab[ky]), std::forward<T>(opt));
|
||||
return get_or(std::move(tab.at(ky)), std::forward<T>(opt));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user