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