I know that dynamic_cast does take execution time and even considered slow, but does static_cast take execution time as well? Here's an example code
void printv(const void *str) {
std::cout << *static_cast<const std::string*>(str) << "\n";
}
void prints(const std::string *str) {
std::cout << *str << "\n";
}
int main()
{
std::string str("my string");
printv(&str);
prints(&str);
system("pause");
return 0;
}
Will printv()
take longer than prints()
because it includes a cast inside?