-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework, Internal Code
-
Query Optimization
-
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