-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Currently the factories (monitors, solvers, hamiltonians) are very simple factories as static methods inside the interface class. This has two problems:
- The interface must include every implementation.
- After writing an implementation both the header and some glue code must be written into the factory.
A cleaner solution is to have the factories as a separate class (making the base class more of a pure implementation/concept) and also implementing some form of self registering method so that the implementations register themselves with the factory in a static context (i.e. created first at runtime) rather than hard coded into the factory.
Possible ideas:
- https://www.jibbow.com/posts/cpp-header-only-self-registering-types/
- https://gist.github.com/alexandervanrenen/c09af12a075a53eba9b6a07d992ed8db
Note:
I once tried this with a method using a complex template inheritance scheme but there was a big drawback (which I can't remember now) so I ditched it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels