I'm wondering about the practical use of dynamic_cast in reusable or
generic code.
I'm currently working on a smart pointer that can be used on vector
and other STL containers.
See following link:
http://code.axter.com/arr_ptr.h
In above code, there's a function called clone_func_ptr_interface
within the func_ptr_holder class.
In this function, I need to cast from a base pointer to a derived
pointer.
I originally used dynamic_cast, but then I realized it would force
anyone using the code to enable RTTI.
I was also worried that using dynamic_cast would make my code less
efficient.
Considering that most projects don't have RTTI enabled, and that
dynamic_cast could result in less efficient code, how practical is it
to use dynamic_cast in reusable or generic code?
Should it be avoided in this type of code, or should it be used
regardless of how less reusable it makes the code?