How to create different instances of a template class where each instance is a different object?
<p>I am working on a generic( multiple types) genetic algorithm.</p>

<p>I want to be able to work with a template class population which will be able to do the algorithm of any of the 3 different classes: <code>bool_individual</code>, <code>real_individual</code>, and <code>Int_individual</code>. each individual class is different and is derived from the abstract class individual.</p>

<p>in a different class' method I passed the required parameters. then I tried to create an object of the template class population; I did this:</p>

<pre><code>population&lt;real_ind&gt; m_population( M,  S, _fraction);
</code></pre>

<p>M,S and _fraction are all parameters for the contractor which should initialize the obj <code>m_population</code>.
the compiler says:</p>

<pre><code>no instance of constractor population&lt;T&gt;::population with T=real_ind matches the argument list arguments types are:(const int, const int, const double)"
</code></pre>

<p>however, this is how i declared the constracor of population:</p>

<pre><code>Population&lt;real_ind&gt; ( const int M, const int S, const double  _fraction)
</code></pre>

<p>the Idea is to create any different flavor of the population object and work with it.</p>

<p>any tips on how this should be done? </p>

<pre><code>enter code here

// constructor of population. 
Population&lt;real_ind&gt; ( const int M, const int S, const double  _fraction)
{ 
for(int i=0;i&lt;M;i++)
{
    pool.push_back(T(S,_fraction));

}

// attempt to construct.
void Evolution&lt;real_ind&gt;::create_evoution(const int M, const int S,const double       _fraction)
</code></pre>

<p>{ 
    population m_population( M,  S, _fraction);
    here the compiler is marking the letter M with a red comma and say that it doesn't     match the arguments.</p>
