MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / UniversalPrintArray

Function UniversalPrintArray

rtpose_wrapper/src/gtest/gtest.h:9796–9816  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9794// elements, starting at address 'begin'.
9795template <typename T>
9796void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
9797 if (len == 0) {
9798 *os << "{}";
9799 } else {
9800 *os << "{ ";
9801 const size_t kThreshold = 18;
9802 const size_t kChunkSize = 8;
9803 // If the array has more than kThreshold elements, we'll have to
9804 // omit some details by printing only the first and the last
9805 // kChunkSize elements.
9806 // TODO(wan@google.com): let the user control the threshold using a flag.
9807 if (len <= kThreshold) {
9808 PrintRawArrayTo(begin, len, os);
9809 } else {
9810 PrintRawArrayTo(begin, kChunkSize, os);
9811 *os << ", ..., ";
9812 PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os);
9813 }
9814 *os << " }";
9815 }
9816}
9817// This overload prints a (const) char array compactly.
9818GTEST_API_ void UniversalPrintArray(const char* begin,
9819 size_t len,

Callers 1

PrintMethod · 0.70

Calls 1

PrintRawArrayToFunction · 0.85

Tested by

no test coverage detected