T
Tim Frink
Hi,
in a book I've found this argumentation for templates instead of void*:
"When using void pointers, the compiler cannot distinguish types, so it
cannot perform type checking or type-specific behavior such as using
type-specific operators, operator overloading, or constructors and
destructors."
What is exactly meant by "type checking" and why is this so important?
Could you provide an example where this might be exploited (and where
void* would fail).
I want to implement a std::list< void* >, so would it be beneficial to
use templates instead? In my case, I see no use for type-specific
operators and operator overloading. Or do I forget something?
Thank you.
Regards,
Tim
in a book I've found this argumentation for templates instead of void*:
"When using void pointers, the compiler cannot distinguish types, so it
cannot perform type checking or type-specific behavior such as using
type-specific operators, operator overloading, or constructors and
destructors."
What is exactly meant by "type checking" and why is this so important?
Could you provide an example where this might be exploited (and where
void* would fail).
I want to implement a std::list< void* >, so would it be beneficial to
use templates instead? In my case, I see no use for type-specific
operators and operator overloading. Or do I forget something?
Thank you.
Regards,
Tim