-
Type:
Improvement
-
Status: Open
-
Priority:
Major - P3
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: Backlog
-
Component/s: Aggregation Framework, Internal Code
-
Labels:
-
Backwards Compatibility:Fully Compatible
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); |
}
|
- is duplicated by
-
SERVER-27309 Replace dynamic_cast calls where possible in pipeline/* code
-
- Closed
-