| 278 | // Format at most ntrunc characters to the given stream. |
| 279 | template<typename T> |
| 280 | inline void formatTruncated(std::ostream& out, const T& value, int ntrunc) |
| 281 | { |
| 282 | std::ostringstream tmp; |
| 283 | tmp << value; |
| 284 | std::string result = tmp.str(); |
| 285 | out.write(result.c_str(), (std::min)(ntrunc, static_cast<int>(result.size()))); |
| 286 | } |
| 287 | #define TINYFORMAT_DEFINE_FORMAT_TRUNCATED_CSTR(type) \ |
| 288 | inline void formatTruncated(std::ostream& out, type* value, int ntrunc) \ |
| 289 | { \ |
no test coverage detected