mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-20 12:58:06 +08:00
feat: enable to convert key char type
This commit is contained in:
@@ -1693,21 +1693,7 @@ parse_simple_key(location& loc, const context<TC>& ctx)
|
|||||||
|
|
||||||
if(const auto bare = syntax::unquoted_key(spec).scan(loc))
|
if(const auto bare = syntax::unquoted_key(spec).scan(loc))
|
||||||
{
|
{
|
||||||
const auto reg = bare.as_string();
|
return ok(to_string_of<typename key_type::value_type>(bare.as_string()));
|
||||||
// here we cannot use `if constexpr` because it is C++11.
|
|
||||||
if(std::is_same<key_type, std::string>::value)
|
|
||||||
{
|
|
||||||
return ok(reg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
key_type k;
|
|
||||||
for(const auto c : reg)
|
|
||||||
{
|
|
||||||
k += typename key_type::value_type(c);
|
|
||||||
}
|
|
||||||
return ok(k);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user