mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-20 04:38:09 +08:00
fix: skip null char in string literal
This commit is contained in:
@@ -119,8 +119,9 @@ struct string_conv_impl
|
||||
static std::basic_string<Char, Traits, Alloc> invoke(const Char2 (&s)[N])
|
||||
{
|
||||
std::basic_string<Char, Traits, Alloc> retval;
|
||||
std::transform(std::begin(s), std::end(s), std::back_inserter(retval),
|
||||
[](const char c) {return static_cast<Char>(c);});
|
||||
// "string literal" has null-char at the end. to skip it, we use prev.
|
||||
std::transform(std::begin(s), std::prev(std::end(s)), std::back_inserter(retval),
|
||||
[](const Char2 c) {return static_cast<Char>(c);});
|
||||
return retval;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user