MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / write_tuple

Function write_tuple

lite/example/cpp_example/npy.h:307–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305
306template <typename T>
307inline std::string write_tuple(const std::vector<T>& v) {
308 if (v.size() == 0)
309 return "";
310
311 std::ostringstream ss;
312
313 if (v.size() == 1) {
314 ss << "(" << v.front() << ",)";
315 } else {
316 const std::string delimiter = ", ";
317 // v.size() > 1
318 ss << "(";
319 std::copy(
320 v.begin(), v.end() - 1,
321 std::ostream_iterator<T>(ss, delimiter.c_str()));
322 ss << v.back();
323 ss << ")";
324 }
325
326 return ss.str();
327}
328
329inline std::string write_boolean(bool b) {
330 if (b)

Callers 1

write_header_dictFunction · 0.70

Calls 7

frontMethod · 0.80
backMethod · 0.80
copyFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected