code size reduction

This commit is contained in:
Wenzel Jakob 2015-07-28 16:12:29 +02:00
parent 43398a8548
commit fbe82bf94d

View File

@ -26,11 +26,8 @@ inline void erase_all(std::string &string, const std::string &search) {
string.erase(pos, search.length()); string.erase(pos, search.length());
} }
} }
NAMESPACE_END(detail)
/// Return a string representation of a C++ type inline void clean_type_id(std::string &name) {
template <typename T> static std::string type_id() {
std::string name(typeid(T).name());
#if defined(__GNUG__) #if defined(__GNUG__)
int status = 0; int status = 0;
std::unique_ptr<char, void (*)(void *)> res { std::unique_ptr<char, void (*)(void *)> res {
@ -43,6 +40,13 @@ template <typename T> static std::string type_id() {
detail::erase_all(name, "enum "); detail::erase_all(name, "enum ");
#endif #endif
detail::erase_all(name, "pybind::"); detail::erase_all(name, "pybind::");
}
NAMESPACE_END(detail)
/// Return a string representation of a C++ type
template <typename T> static std::string type_id() {
std::string name(typeid(T).name());
detail::clean_type_id(name);
return name; return name;
} }