my compiler is giving me an error that vector is not template I'm using visual studio 2012
template <>
class vector <bool>
{
// interface
private:
unsigned int *vector_data;
int length;
int size;
};
The template<> tells the compiler that you're trying to specialise a template class called vector. So you have your own class template vector? Or are you trying to specialize std::vector? If the former, I'd use a different name to avoid any possible confusion with std::template.
Because you're still not specializing an existing template.
1 2 3 4 5 6 7 8 9 10 11 12 13
// the template
template <typename T>
class A
{
// whatever you need to do to variables of type "T"
};
// the specialization of the existing template A for char
template <>
class A<char>
{
// whatever you want to do to specialize A for char
};
See the "Template specialization" section on this page: