Template Linked Lists
So what exactly is the difference between an ordinary C-style cast and using static_cast?
quote:
So what exactly is the difference between an ordinary C-style cast and using static_cast?
In a nut shell? C pretends that the data was always of the data type that you cast it to, and then runs with it. C++ style casts do some level of type checking first. If something goes wrong with your cast, C++ will barf before C does.
quote: Original post by SiCrane
...
An alternative is to use void * for data in your linked list. Then you only have one set of linked list code for all data types.
...
I tried using a void pointer when I was making a linked list a while back.... All I got was a void object when I tried to store it in the void pointer! I think this is because my compiler treats void objects as non-existent or empty.
www.trak.to/rdp
--------------------
You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor
You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement