correction of core dump
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user