Skip to content

Commit 6ff0321

Browse files
committed
Simplify db_copy_mgr_t::add_value()
The reason we had a different implementation for "double" values here is that std::to_string() uses the current locale for writing out numbers. For integers this doesn't matter, but for doubles this could be something different than a decimal point. The fmt::to_string() function on the other hand always uses the default locale, so it doesn't have this problem. So we can use this for integers as well as for doubles.
1 parent 8e783e9 commit 6ff0321

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/db-copy-mgr.hpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,7 @@ class db_copy_mgr_t
290290
template <typename T>
291291
void add_value(T value)
292292
{
293-
m_current->buffer += std::to_string(value);
294-
}
295-
296-
void add_value(double value)
297-
{
298-
util::double_to_buffer tmp{value};
299-
m_current->buffer += tmp.c_str();
293+
m_current->buffer += fmt::to_string(value);
300294
}
301295

302296
void add_value(std::string const &s) { add_value(s.c_str()); }

0 commit comments

Comments
 (0)