Quantcast
Channel: Comparing polymorphic types in c++20 - Stack Overflow
Browsing all 5 articles
Browse latest View live

Answer by trent for Comparing polymorphic types in c++20

This does not look like a problem of polymorphism. Actually, I think that there is any polymorphism at all is a symptom of a data model error.If you have values that identify machines, and values that...

View Article



Answer by goodvibration for Comparing polymorphic types in c++20

OK, I see it wasn't mentioned in the answer given by @dfrib, so I'll extend that answer to show it.You could add an abstract (pure virtual) function in the Identifier structure, which returns its...

View Article

Answer by dfrib for Comparing polymorphic types in c++20

As an intermediate solution you could re-factor your polymorphic equality operator== to a non-virtual operator== defined in the base class, which polymorphically dispatches to a non-operator virtual...

View Article

Answer by scohe001 for Comparing polymorphic types in c++20

You don't have any polymorphism in your code. You can force a dynamic binding of the comparison operator function (polymorphism) by using either Identifier pointers or references.For example, instead...

View Article

Comparing polymorphic types in c++20

I have code that is somewhere between c++17 and c++20. Specifically, we have c++20 enabled on GCC-9 and clang-9, where it is only partially implemented.In code we have quite big hierarchy of...

View Article

Browsing all 5 articles
Browse latest View live




Latest Images