correction of core dump

This commit is contained in:
hugogogo
2022-06-17 01:00:53 +02:00
parent e3151bce4e
commit da4ebc13fd
6 changed files with 1177 additions and 548 deletions

View File

@@ -71,6 +71,7 @@ std::vector<mystruct*> mem_list;
// ****************************************
# define TITLE(s) std::cout << "\n" B_PURPLE #s RESET "\n\n";
# define VAL(n) val<T>(n)
# define TOI(n) toi<T>(n)
# define PRINT(n) print_vector<T>(n);
# define DELETE delete_structs();
@@ -106,6 +107,35 @@ template <>
}
// convert a value
// *****************************************
template <class T>
int toi(T t) {(void)t; return (0);
}
template <>
int toi(int i) {return (i);
}
template <>
int toi(char c) {return (c);
}
template <>
int toi(std::string str) {
int i;
std::stringstream stream;
stream << str;
stream >> i;
stream.clear();
return (i);
}
template <>
int toi(mystruct* s) {
return ( s->get_data()[0] );
}
// get a value
// *********************************************
template <class T>