Details
-
Improvement
-
Resolution: Unresolved
-
Major - P3
-
None
-
None
-
Query Optimization
-
Fully Compatible
Description
We often use dynamic_cast when we really want to check if something is an exact type. dynamic_cast is unnecessarily expensive for this use, and we should use typeid instead.
For example, we could create a helper as follows:
template <TargetClass> |
bool exactDynamicCast(void* srcObj) { |
return typeid(TargetClass) == typeid(*srcObj); |
}
|
Attachments
Issue Links
- is duplicated by
-
SERVER-27309 Replace dynamic_cast calls where possible in pipeline/* code
-
- Closed
-