> Is there any design error by which I need the template type of the solution in every other class?

That dependency is quite common in Genetic Algorithm / Genetic Programming frameworks and it isn't *per se* a design error.

There are two reasons because of which your code looks that way:

- classes that interact with `Solution`s often need to store them (trials, best so far...) or classes depending on them.

  Type erasure (e.g. [`boost::any`][1]) doesn't mix well and [`boost::variant`][2] introduces unwanted constraints.

- [member function templates cannot be declared virtual][3] but virtual methods are often a necessity (in your snippet `applyOp`, `exploreNg`...). In contrast ordinary members of class templates can be virtual and this is a further "incentive".

Consider that [template template parameters][4] (and good default values) could be a way to lower the perceived complexity of using the library and help with the coordination of the types among the various classes.


  [1]: http://www.boost.org/libs/any
  [2]: http://www.boost.org/libs/variant
  [3]: http://stackoverflow.com/q/2354210/3235496
  [4]: http://stackoverflow.com/q/213761/3235496