MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / parse_tuple

Function parse_tuple

include/libnpy/npy.hpp:298–316  ·  view source on GitHub ↗

Parses the string represenatation of a Python tuple into a vector of its items */

Source from the content-addressed store, hash-verified

296 Parses the string represenatation of a Python tuple into a vector of its items
297 */
298inline std::vector <std::string> parse_tuple(std::string in) {
299 std::vector <std::string> v;
300 const char seperator = ',';
301
302 in = trim(in);
303
304 if ((in.front() == '(') && (in.back() == ')'))
305 in = in.substr(1, in.length() - 2);
306 else
307 throw std::runtime_error("Invalid Python tuple.");
308
309 std::istringstream iss(in);
310
311 for (std::string token; std::getline(iss, token, seperator);) {
312 v.push_back(token);
313 }
314
315 return v;
316}
317
318template<typename T>
319inline std::string write_tuple(const std::vector <T> &v) {

Callers 1

parse_headerFunction · 0.85

Calls 2

push_backMethod · 0.80
trimFunction · 0.70

Tested by

no test coverage detected