C++ static_cast runtime overhead

static_cast<T>(e) is equivalent to creating an invented temporary variable v in the following way:

T v(e); //where T is an arbitrary type  and e is an arbitrary expression.

The runtime cost of a static_cast is exactly the cost of the above statement

Leave a Comment