| 123 | // In contrast to std::stringstream, "char" values are |
| 124 | // converted to a string of digits, and we don't use scientific notation. |
| 125 | template<typename T> std::string NumToString(T t) { |
| 126 | // clang-format off |
| 127 | |
| 128 | #ifndef FLATBUFFERS_PREFER_PRINTF |
| 129 | std::stringstream ss; |
| 130 | ss << t; |
| 131 | return ss.str(); |
| 132 | #else // FLATBUFFERS_PREFER_PRINTF |
| 133 | auto v = static_cast<long long>(t); |
| 134 | return NumToStringImplWrapper(v, "%.*lld"); |
| 135 | #endif // FLATBUFFERS_PREFER_PRINTF |
| 136 | // clang-format on |
| 137 | } |
| 138 | // Avoid char types used as character data. |
| 139 | template<> inline std::string NumToString<signed char>(signed char t) { |
| 140 | return NumToString(static_cast<int>(t)); |
no test coverage detected