dynamic-cast
Variadic templates and dynamic cast
I have a piece of C++ code as follows: template <typename ...A> struct CastAll{ template <typename ...B>[详细]
2023-04-03 21:24 分类:问答Are dynamic_casts safe to remove in production code?
dynamic_casts are slow开发者_开发问答er, but they are safer than static_casts (when used with object hierarchies, of course). My question is, after I\'ve ensured in my debug code that all (dynamic) ca[详细]
2023-04-03 14:00 分类:问答Losing RTTI info after returning from a function
Given a class and subclass: class Event {...} class Note : public Event {...} A Note is Cloned and stored in a pointer within a function f(). The type-information is preserved in the pointer and ca[详细]
2023-03-31 13:02 分类:问答How does dynamic_cast fail?
According to what I read, performing a wrong run-time dynamic_cast can either throw a bad_cast exception or return zero.[详细]
2023-03-31 11:12 分类:问答Fast dynamic casting progress
A little while ago, I found that very interesting paper on a very neat performance upgrade for dynamic_cast in C++: http://www2.research.att.com/~bs/fast_dynamic_casting.pdf.[详细]
2023-03-30 21:33 分类:问答Refactoring advice: How to avoid type checking in this OO design
I\'m looking for advice on refactoring to improve my class design and avoid type checking. I am using the Command design pattern to construct a menu tree. An item in the menu could be of various type[详细]
2023-03-26 03:14 分类:问答What's faster: down-cast from virtual base or cross-cast?
This is somewhat hypothetical as I\'m not too worried about performance - just wondering which option is actually the fastest/most efficient in general, or if there is no difference whatsoever.[详细]
2023-03-25 16:34 分类:问答What are the arguments to the types.CodeType() python call?
I\'m currently trying to roll my own \"marshal\" code for python so i can store compiled python code on Google App Engine to serve scripts on a dynamic way. As you all can verify, \"marshal\" isn\'t s[详细]
2023-03-18 12:21 分类:问答dynamic_cast to the same type does not check type of object
I am trying to determine whether an object pointed by a T* pointer is truly a T object, or some other, unrelated type. I tried dynamic_cast, however it is less than useless, it returns the pointer its[详细]
2023-03-16 09:39 分类:问答Does dynamic_cast work inside overloaded operator delete?
I came across this: struct Base { void* operator new (size_t); void operator delete (void*); virtual ~Base () {}// <--- polymorphic[详细]
2023-03-15 01:00 分类:问答