mlpack  3.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
strip_type.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_BINDINGS_UTIL_STRIP_TYPE_HPP
14 #define MLPACK_BINDINGS_UTIL_STRIP_TYPE_HPP
15 
16 namespace mlpack {
17 namespace util {
18 
28 {
29  // Basically what we need to do is strip any '<' (template bits) from the
30  // type. We'll try first by removing any instances of <>.
31  const size_t loc = cppType.find("<>");
32  if (loc != std::string::npos)
33  cppType.replace(loc, 2, "");
34 
35  // Let's just replace any invalid characters with valid '_' characters.
36  std::replace(cppType.begin(), cppType.end(), '<', '_');
37  std::replace(cppType.begin(), cppType.end(), '>', '_');
38  std::replace(cppType.begin(), cppType.end(), ' ', '_');
39  std::replace(cppType.begin(), cppType.end(), ',', '_');
40 
41  return cppType;
42 }
43 
44 } // namespace util
45 } // namespace mlpack
46 
47 #endif
std::string StripType(std::string cppType)
Given a C++ type name, turn it into something that has no special characters that can simply be print...
Definition: strip_type.hpp:27
src mlpack core util version hpp VERSION_HPP_CONTENTS string(REGEX REPLACE".*#define MLPACK_VERSION_MAJOR ([0-9]+).*""\\1"MLPACK_VERSION_MAJOR"${VERSION_HPP_CONTENTS}") string(REGEX REPLACE".* MLPACK_VERSION_MINOR "$
Definition: CMakeLists.txt:79