Skip to content

GeneratorObjects: Fix compilation with c++20.

With c++20, GenParticle*==HepMcParticleLink was ambiguous.

  • The second argument could convert to GenParticle* and then compare using the built-in == operation.
  • The first argument could convert to HepMcParticleLink and the compare using HepMcParticleLink::operator==.

The second of these is only allowed in c++20 due to the fact that operator== is implicitly reversable (otherwise, we wouldn't be able to convert the first argument as this is a member function).

Add an explicit operator== for this case to disambiguate (choosing the first alternative).

Merge request reports