• Advertisement

Archived

This topic is now archived and is closed to further replies.

Who knows what's what about "static_cast<T>()"?

This topic is 5995 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Alrighty, I''m piecing together a solution, however temporary, to a parallel Bridge pattern problem I posted yesterday in General Graphics (hope somebody responds to that one eventually . . .). To implement it, however, I''d like to use static_cast() rather than an icky C-style downcast. I''m interested in the time-complexity. The C++ FAQs book reports that dynamic_cast() can have linear time complexity to execute at runtime because it may have to search the entire class hierarchy to ensure that it''s a good cast. Does static_cast() have linear complexity? If so, is the time eaten at runtime or compile time? This is kinda silly, since the class hierarchy is pretty small, but it''s also extensible, so I still want to know. --- blahpers

Share this post


Link to post
Share on other sites
Advertisement
static_cast<>() is resolved at compile time.

Share this post


Link to post
Share on other sites

  • Advertisement