MCPcopy Create free account
hub / github.com/ElementsProject/elements / formatTruncated

Function formatTruncated

src/tinyformat.h:288–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286// Format at most ntrunc characters to the given stream.
287template<typename T>
288inline void formatTruncated(std::ostream& out, const T& value, int ntrunc)
289{
290 std::ostringstream tmp;
291 tmp << value;
292 std::string result = tmp.str();
293 out.write(result.c_str(), (std::min)(ntrunc, static_cast<int>(result.size())));
294}
295#define TINYFORMAT_DEFINE_FORMAT_TRUNCATED_CSTR(type) \
296inline void formatTruncated(std::ostream& out, type* value, int ntrunc) \
297{ \

Callers 1

formatValueFunction · 0.85

Calls 3

strMethod · 0.80
writeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected