diff --git a/toml/serializer.hpp b/toml/serializer.hpp index c25f8b2..68bdbcc 100644 --- a/toml/serializer.hpp +++ b/toml/serializer.hpp @@ -36,7 +36,7 @@ struct serializer std::vector buf(bsz + 1, '\0'); // +1 for null character(\0) std::snprintf(buf.data(), buf.size(), fmt, this->float_prec_, f); - std::string token(buf.begin(), buf.end()); + std::string token(buf.begin(), std::prev(buf.end())); if(token.back() == '.') // 1. => 1.0 { token += '0';