Templates C++ error : could not deduce template argument
<p>I am trying ot add a function template that will print if it contains precision values or valves and the value. The rest of the program works except this function. I am not sure what I am doing wrong but the error I recieve is:</p>

<p>error C2784: 'void printInstrumentDetail(const I *const )' : could not deduce template argument for 'const I *const ' from 'std::vector&lt;_Ty>'</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;iomanip&gt;
#include &lt;string&gt;
#include "Instruments.h"
#include "Brass.h"
#include "Strings.h"

using namespace std;

//template&lt;typename I&gt;           &lt;---Problem
//void printInstrumentDetail(const I * const a)
//{
//   for (size_t i = 0; i &lt; 6; i ++)
//  {
//   cout &lt;&lt; "The details for " &lt;&lt; a[i]-&gt;getName()
//    &lt;&lt; ": " &lt;&lt; a[i]-&gt;print();
//  }
//}
int main()
{
    double total = 0;

    Strings violin("Violin", 553.90, 3);
    Strings cello("Cello", 876.45, 3);
    Strings viola("Viola", 200.50, 23);
    Brass tuba("Tuba", 1400.10, 1.23);
    Brass trumpet("Trumpet", 500.00, 4.32);
    Brass sax("Sax", 674.78, .99);

    vector &lt;Instruments *&gt; band(6);

    band[0] = &amp;violin;
    band[1] = &amp;tuba;
    band[2] = &amp;cello;
    band[3] = &amp;trumpet;
    band[4] = &amp;viola;
    band[5] = &amp;sax;

    cout &lt;&lt; fixed &lt;&lt; setprecision(2);

    cout &lt;&lt; "The instruments in the band are:\n";
    //Get name and cost of each
    for (size_t i = 0; i &lt; 6; i ++)
    {
     cout &lt;&lt; band[i]-&gt;getName() &lt;&lt; "  $" 
      &lt;&lt; band[i]-&gt;getCost() &lt;&lt; endl;
    }

    cout &lt;&lt; "\nThen band is warming up..." &lt;&lt; endl;
    //Get descrition of how sound is made of each
    for (size_t i = 0; i &lt; 6; i ++)
    {
     cout &lt;&lt; "This " &lt;&lt; band[i]-&gt;getName()
      &lt;&lt; " makes sounds by " ;
     band[i]-&gt;playSound();
    }
    cout &lt;&lt; "\nTotal cost of the band is: $" ;
    //Get total cost of all instruments
    for (size_t i = 0; i &lt; 6; i ++)
    {

     total = band[i]-&gt;getCost() + total;
    }
    cout &lt;&lt; total &lt;&lt; endl;

    //printInstrumentDetail(band);                     &lt;--Problem

    return 0;
}
</code></pre>

<p>Here's the base class:</p>

<pre><code>#ifndef INSTRUMENTS_H
#define INSTRUMENTS_H

#include &lt;string&gt;

using namespace std;

class Instruments
{
public:
    Instruments(string, double);

    void setName(string);
    virtual string getName();

    void setCost(double);
    virtual double getCost();

    virtual void print();

    virtual void playSound();

private:
    string name;
    double cost;
};
#endif

#include &lt;iostream&gt;
#include "Instruments.h"

using namespace std;

Instruments::Instruments(string n, double c)
{
    name = n;
    cost = c;
}
void Instruments::setName(string n)
{
    name = n;
}
string Instruments::getName()
{
    return name;
}
void Instruments::setCost(double c)
{
    cost = c;
}
double Instruments::getCost()
{
    return cost;
}
void Instruments::print() 
{

}
void Instruments::playSound()
{
    //empty
}
</code></pre>

<p>Derived class Bass:</p>

<pre><code>#ifndef BRASS_H
#define BRASS_H

#include &lt;string&gt;
#include "Instruments.h"

using namespace std;

class Brass : public Instruments
{
public:
    Brass(string, double, double);

    void setPrecisionValue(double);
    double getPrecisionValue();
    void print() ;
     void playSound();

private:
    double precision;
    string sound;
};
#endif

#include &lt;iostream&gt;
#include "Brass.h"

using namespace std;

Brass::Brass(string n, double c, double p)
:Instruments(n, c)
{
    precision = p;
}
void Brass::setPrecisionValue(double p)
{
    precision = p;
}
double Brass::getPrecisionValue()
{
    return precision;
}
void Brass::print() 
{
    cout &lt;&lt; getPrecisionValue() &lt;&lt; endl;
}
void Brass::playSound()
{
    cout &lt;&lt; "blowing in a mouthpiece." &lt;&lt; endl;
    Instruments::playSound();
}
</code></pre>

<p>Derived class Strings:</p>

<pre><code>#ifndef STRINGS_H
#define STRINGS_H

#include &lt;string&gt;
#include "Instruments.h"

using namespace std;

class Strings : public Instruments
{
public:
    Strings(string, double, int);

    void setValves(int);
    int getValves();
    void print();
    void playSound();

private:
    int valves;
};
#endif

#include &lt;iostream&gt;
#include "Strings.h"

using namespace std;

Strings::Strings(string n, double c, int v)
    :Instruments(n, c)
{
    valves = v; 
}
void Strings::setValves(int v)
{
    valves = v;
}
int Strings::getValves()
{
    return valves;
}
void Strings::print() 
{
    cout&lt;&lt; getValves() &lt;&lt; endl;
}
void Strings::playSound()
{
    cout &lt;&lt; "striking with a bow." &lt;&lt; endl;
    Instruments::playSound();
}
</code></pre>
