diff --git a/modules/c++/str/include/str/Convert.h b/modules/c++/str/include/str/Convert.h index ca154a6a1..5e29d8c14 100644 --- a/modules/c++/str/include/str/Convert.h +++ b/modules/c++/str/include/str/Convert.h @@ -55,13 +55,19 @@ template int getPrecision(const types::ComplexInteger&); // Note that std::to_string() doesn't necessarily generate the same output as writing // to std::cout; see https://en.cppreference.com/w/cpp/string/basic_string/to_string template -std::string toString_(const T& value) +std::string toString__(const T& value, int precision) { std::ostringstream buf; - buf.precision(getPrecision(value)); + buf.precision(precision); buf << std::boolalpha << value; return buf.str(); } + +template +std::string toString_(const T& value) +{ + return toString__(value, getPrecision(value)); +} template inline std::string toString(const T& value) {