diff options
author | Adam <Adam@anope.org> | 2013-11-01 05:19:48 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-11-01 05:19:48 -0400 |
commit | 6e8d2bf09dbc349df5e2d2094a83a60c6309b76b (patch) | |
tree | 8c23a216d92f81cf09a18ce72eae503100100cb4 /include/anope.h | |
parent | 70e9b2027481273a4284b9f007e8592b016defe1 (diff) |
Attempt #3
Diffstat (limited to 'include/anope.h')
-rw-r--r-- | include/anope.h | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/include/anope.h b/include/anope.h index 07ed29ebf..c96360810 100644 --- a/include/anope.h +++ b/include/anope.h @@ -762,26 +762,13 @@ template<typename T> inline T convertTo(const Anope::string &s, bool failIfLefto */ #ifdef DEBUG_BUILD # include <typeinfo> - -template<typename T, typename O> inline T anope_dynamic_static_cast(O* ptr) +template<typename T, typename O> inline T anope_dynamic_static_cast(O ptr) { T ret = dynamic_cast<T>(ptr); if (ptr != NULL && ret == NULL) - throw CoreException(Anope::string("anope_dynamic_static_cast<") + typeid(T).name() + ">(" + typeid(O*).name() + ") fail"); + throw CoreException(Anope::string("anope_dynamic_static_cast<") + typeid(T).name() + ">(" + typeid(O).name() + ") fail"); return ret; } - -template<typename T, typename O> inline T anope_dynamic_static_cast(O& ref) -{ - try - { - return dynamic_cast<T>(ref); - } - catch (const std::bad_cast &ex) - { - throw CoreException(Anope::string("std::bad_cast from anope_dynamic_static_cast<") + typeid(T).name() + ">(" + typeid(O&).name() + "): " + ex.what()); - } -} #else template<typename T, typename O> inline T anope_dynamic_static_cast(O ptr) { |