79828608

Date: 2025-11-24 12:14:19
Score: 2.5
Natty:
Report link

Regarding the advice to avoid dynamic_cast, message definitely received, but the main challenge is that some_method actually has a return type of DerivedA for its implementation in DerivedA, and DerivedB for its implementation in DerivedB. And this return type is precisely what I am trying to cast to.

Perhaps I skipped important contextual info in my effort to simplify my example. To be specific,

As a less terrible compromise, I've made an intermediate DerivedX: public Base which is a template that takes the type of the underlying matrix wrapped by DerivedA and DerivedB, implements the dynamic cast, but also replicates each operation with a templated version of the operation, to allow mixed operations.

Reasons:
  • Blacklisted phrase (0.5): thanks
  • Blacklisted phrase (1): I am trying to
  • Blacklisted phrase (0.5): I cannot
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: josh_eime