MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CatPieces

Function CatPieces

tensorflow/core/lib/strings/strcat.cc:120–135  ·  view source on GitHub ↗

Do not call directly - these are not part of the public API.

Source from the content-addressed store, hash-verified

118
119// Do not call directly - these are not part of the public API.
120string CatPieces(std::initializer_list<StringPiece> pieces) {
121 string result;
122 size_t total_size = 0;
123 for (const StringPiece piece : pieces) total_size += piece.size();
124 gtl::STLStringResizeUninitialized(&result, total_size);
125
126 char *const begin = &*result.begin();
127 char *out = begin;
128 for (const StringPiece piece : pieces) {
129 const size_t this_size = piece.size();
130 memcpy(out, piece.data(), this_size);
131 out += this_size;
132 }
133 DCHECK_EQ(out, begin + result.size());
134 return result;
135}
136
137// It's possible to call StrAppend with a StringPiece that is itself a fragment
138// of the string we're appending to. However the results of this are random.

Callers 1

StrCatFunction · 0.85

Calls 4

sizeMethod · 0.45
beginMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected