13 #ifndef MLPACK_BINDINGS_GO_STRIP_TYPE_HPP 14 #define MLPACK_BINDINGS_GO_STRIP_TYPE_HPP 31 std::string& goStrippedType,
32 std::string& strippedType,
33 std::string& printedType,
34 std::string& defaultsType)
38 goStrippedType = inputType;
39 printedType = inputType;
40 strippedType = inputType;
41 defaultsType = inputType;
45 for (
size_t i = 0; i < goStrippedType.size(); i++)
47 goStrippedType[i] = std::tolower(goStrippedType[i]);
48 if (std::isupper(goStrippedType[i+1]) && !std::isupper(goStrippedType[i+2]))
50 if (isalpha(goStrippedType[i+2]))
55 if (printedType.find(
"<") != std::string::npos)
58 const size_t loc = printedType.find(
"<>");
59 if (loc != std::string::npos)
62 goStrippedType.replace(loc, 2,
"");
63 strippedType.replace(loc, 2,
"");
64 printedType.replace(loc, 2,
"<>");
65 defaultsType.replace(loc, 2,
"<T>");
void StripType(const std::string &inputType, std::string &goStrippedType, std::string &strippedType, std::string &printedType, std::string &defaultsType)
Given an input type like, e.g., "LogisticRegression<>", return four types that can be used in Go code...
Linear algebra utility functions, generally performed on matrices or vectors.