MCPcopy Create free account
hub / github.com/apache/singa / UniversalPrintArray

Function UniversalPrintArray

test/gtest/gtest.h:9802–9822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

PrintMethod · 0.70

Calls 1

PrintRawArrayToFunction · 0.85

Tested by

no test coverage detected