79392161

Date: 2025-01-27 21:01:34
Score: 0.5
Natty:
Report link

Modules cannot depend on each other in a circular way. With traditional header files, you can solve that with forward declarations, but with modules you can't because you cannot forward declare things in a way that makes it clear that the declared entity is owned by another module.

The way to do what you want to do is to use "module partitions". In that case, you can put everything into one module, but the declarations and implementations of the two classes are split into different partitions. Within a partition, then, you can forward declare classes that are declared/defined in the other partition because everything that is part of different partitions is still owned by the same module.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Wolfgang Bangerth