L
Loopy
Assume I have (excuse possible unintended syntax errors)
template <class T>
class vector
{
....
void Add(const T &);
.....
}
template <class T>
void vector::Add(const T&t)
{
.......
}
And I have another template class
template <class T>
class matrix
{
....
....
}
I want to specialize vector::Add for all matrix<T>
e.g. something like
void vector< matrix<T> >::Add(const matrix<T> &t)
{
.......
}
At the moment I am writing
template <>
void vector< matrix<float> >::Add(const matrix<float> &t)
{
.......
}
template <>
void vector< matrix<float> >::Add(const matrix<double> &t)
{
.......
}
etc.......
Just can't figure the syntax and searching has not turned up a
solution...
Andrew
template <class T>
class vector
{
....
void Add(const T &);
.....
}
template <class T>
void vector::Add(const T&t)
{
.......
}
And I have another template class
template <class T>
class matrix
{
....
....
}
I want to specialize vector::Add for all matrix<T>
e.g. something like
void vector< matrix<T> >::Add(const matrix<T> &t)
{
.......
}
At the moment I am writing
template <>
void vector< matrix<float> >::Add(const matrix<float> &t)
{
.......
}
template <>
void vector< matrix<float> >::Add(const matrix<double> &t)
{
.......
}
etc.......
Just can't figure the syntax and searching has not turned up a
solution...
Andrew