By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,820 Members | 1,154 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,820 IT Pros & Developers. It's quick & easy.

how static_cast and dynamic_cast implemented?

P: n/a
all,

curious what's the implementation and compiling details of these two and
other C++ cast operators such as const_cast and reinterpret_cast...they
look like templated class with constructor checking the typeid of the
input object and return the target object...

thanks,

yuming,
Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


Yuming Ma wrote:
curious what's the implementation and compiling details of these two and
other C++ cast operators such as const_cast and reinterpret_cast...they
look like templated class with constructor checking the typeid of the
input object and return the target object...


No, they're done at compile-time, not run-time. Since they're built
into the language, they're not actually templated classes. However, I
wouldn't think they'd be hard to implement as function templates with
constraints. I wonder, why weren't they made library elements? Hm...
Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.