mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-09-19 15:19:54 +00:00
🔀 Merge branch 'master' into v3
This commit is contained in:
commit
d8a9ee4f72
@ -1170,6 +1170,8 @@ I appreciate the help of the contributors who introduced the great feature to th
|
||||
- Fixed warnings on MSVC
|
||||
- Ivan Shynkarenka (@chronoxor)
|
||||
- Fixed Visual Studio 2019 warnings
|
||||
- @khoitd1997
|
||||
- Fixed warnings while type conversion
|
||||
|
||||
## Licensing terms
|
||||
|
||||
|
@ -45,7 +45,7 @@ inline std::string show_char(const char c)
|
||||
buf.fill('\0');
|
||||
const auto r = std::snprintf(
|
||||
buf.data(), buf.size(), "0x%02x", static_cast<int>(c) & 0xFF);
|
||||
assert(r == buf.size() - 1);
|
||||
assert(r == static_cast<int>(buf.size()) - 1);
|
||||
return std::string(buf.data());
|
||||
}
|
||||
}
|
||||
|
12
toml/get.hpp
12
toml/get.hpp
@ -713,7 +713,7 @@ get_or(basic_value<C, M, V>&& v, T&& opt)
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
return std::string(opt);
|
||||
return std::forward<T>(opt);
|
||||
}
|
||||
}
|
||||
|
||||
@ -829,10 +829,10 @@ template<typename T, typename C,
|
||||
detail::enable_if_t<std::is_same<T, std::string>::value, std::string>
|
||||
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.at(ky)), std::forward<T>(opt));
|
||||
if(!v.is_table()) {return std::forward<T>(opt);}
|
||||
auto tab = toml::get<toml::table>(std::move(v));
|
||||
if(tab.count(ky) == 0) {return std::forward<T>(opt);}
|
||||
return get_or(std::move(tab[ky]), std::forward<T>(opt));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -934,7 +934,7 @@ detail::enable_if_t<detail::conjunction<
|
||||
>::value, std::string>
|
||||
find_or(Table&& tab, const key& ky, T&& opt)
|
||||
{
|
||||
if(tab.count(ky) == 0) {return opt;}
|
||||
if(tab.count(ky) == 0) {return std::forward<T>(opt);}
|
||||
return get_or(std::move(tab[ky]), std::forward<T>(opt));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user