Skip to content
Snippets Groups Projects
Commit 8219e470 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

issue76fix_proposal

parent 3bbf61b7
No related branches found
No related tags found
No related merge requests found
...@@ -45,33 +45,6 @@ namespace std { ...@@ -45,33 +45,6 @@ namespace std {
typedef typename get_type_pack_element < N - 1, Ts ... >::type type; typedef typename get_type_pack_element < N - 1, Ts ... >::type type;
}; };
   
template<typename T>
bool is_same_type(const char* name) {
int status;
char namespaceId[100];
char classId[100];
char* ret = abi::__cxa_demangle(typeid(T).name(), 0, 0, &status);
sscanf(ret, "%[a-zA-Z]::%[a-zA-Z]", namespaceId, classId);
free( ret );
if(strcmp(classId, name) == 0) {
return true;
} else {
return false;
}
}
template <class T>
char* type_name() {
int status;
return abi::__cxa_demangle(typeid(T).name(), 0, 0, &status);
}
char* type_name(const std::type_info& type);
char* type_name(const std::type_index& type);
} /* namespace std */ } /* namespace std */
   
#endif // TYPE_TRAITS_HPP_ #endif // TYPE_TRAITS_HPP_
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Author: Jan Travnicek * Author: Jan Travnicek
*/ */
   
#include "../type_traits" #include "../typeinfo"
   
namespace std { namespace std {
   
......
/*
* typeindex.hpp
*
* Created on: Apr 1, 2013
* Author: Jan Travnicek
*/
#ifndef TYPEINFO_H_
#define TYPEINFO_H_
namespace std {
char* type_name(const std::type_info& type);
char* type_name(const std::type_index& type);
template <class T>
char* type_name() {
return type_name(typeid(T));
}
template<typename T>
bool is_same_type(const char* name) {
char namespaceId[100];
char classId[100];
char* ret = type_name<T>();
sscanf(ret, "%[a-zA-Z]::%[a-zA-Z]", namespaceId, classId);
free( ret );
if(strcmp(classId, name) == 0) {
return true;
} else {
return false;
}
}
}
#endif // ifndef TYPEINFO_H_
...@@ -2,11 +2,6 @@ ...@@ -2,11 +2,6 @@
#define __TYPE_TRAITS_HEADER_WRAPPER_ #define __TYPE_TRAITS_HEADER_WRAPPER_
   
#include <bits/../type_traits> #include <bits/../type_traits>
#include <cxxabi.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <typeindex>
#include "extensions/type_traits.hpp" #include "extensions/type_traits.hpp"
   
#endif /* __TYPE_TRAITS_HEADER_WRAPPER_ */ #endif /* __TYPE_TRAITS_HEADER_WRAPPER_ */
#ifndef __TYPEINFO_HEADER_WRAPPER_
#define __TYPEINFO_HEADER_WRAPPER_
#include <bits/../typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cxxabi.h>
#include "typeindex"
#include "extensions/typeinfo.hpp"
#endif /* __TYPEINFO_HEADER_WRAPPER_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment