mlpack  3.1.1
 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_JULIA_STRIP_TYPE_HPP
14 #define MLPACK_BINDINGS_JULIA_STRIP_TYPE_HPP
15 
16 namespace mlpack {
17 namespace bindings {
18 namespace julia {
19 
29 {
30  // Basically what we need to do is strip any '<' (template bits) from the
31  // type. We'll try first by removing any instances of <>.
32  const size_t loc = cppType.find("<>");
33  if (loc != std::string::npos)
34  cppType.replace(loc, 2, "");
35 
36  // Let's just replace any invalid characters with valid '_' characters.
37  std::replace(cppType.begin(), cppType.end(), '<', '_');
38  std::replace(cppType.begin(), cppType.end(), '>', '_');
39  std::replace(cppType.begin(), cppType.end(), ' ', '_');
40  std::replace(cppType.begin(), cppType.end(), ',', '_');
41 
42  return cppType;
43 }
44 
45 } // namespace julia
46 } // namespace bindings
47 } // namespace mlpack
48 
49 #endif
string(REGEX REPLACE".*#define MLPACK_VERSION_MINOR ([0-9]+).*""\\1"MLPACK_VERSION_MINOR"${VERSION_HPP_CONTENTS}") string(REGEX REPLACE".* "\\1" MLPACK_VERSION_PATCH "$
Definition: CMakeLists.txt:35
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:28