S
shuisheng
Dear All;
Would you please help me to look at the following case:
//! Rotation.
enum Rotation {
NON_CYCLIC,
CYCLIC
};
//! Rotation.
enum Direction {
LEFT,
RIGHT
};
//! This is a class template of TinyVector
template<class _T, size_t _n>
class TinyVector
{
public:
//! Rotate.
template<Direction _dir, Rotation _rot>
TinyVector& Rotate(size_t n);
}
//! Rotate.
template<class _T, size_t _n>
template<Direction _dir, Rotation _rot>
inline typename TinyVector<_T, _n>& TinyVector<_T, _n>::Rotate(size_t
n)
{
...
return *this;
}
//! Rotate<LEFT, NON_CYCLIC>.
template<class _T, size_t _n>
template<>
inline typename TinyVector<_T, _n>& TinyVector<_T, _n>::Rotate<LEFT,
NON_CYCLIC>(size_t n)
{
...
return *this;
} // <-- Error position
Error C2768: 'TinyVector<_T,_n>::Rotate' : illegal use of explicit
template arguments
I realy appreciate your guys' help. It make me to learn c++ much more
comforably.
Shuisheng
Would you please help me to look at the following case:
//! Rotation.
enum Rotation {
NON_CYCLIC,
CYCLIC
};
//! Rotation.
enum Direction {
LEFT,
RIGHT
};
//! This is a class template of TinyVector
template<class _T, size_t _n>
class TinyVector
{
public:
//! Rotate.
template<Direction _dir, Rotation _rot>
TinyVector& Rotate(size_t n);
}
//! Rotate.
template<class _T, size_t _n>
template<Direction _dir, Rotation _rot>
inline typename TinyVector<_T, _n>& TinyVector<_T, _n>::Rotate(size_t
n)
{
...
return *this;
}
//! Rotate<LEFT, NON_CYCLIC>.
template<class _T, size_t _n>
template<>
inline typename TinyVector<_T, _n>& TinyVector<_T, _n>::Rotate<LEFT,
NON_CYCLIC>(size_t n)
{
...
return *this;
} // <-- Error position
Error C2768: 'TinyVector<_T,_n>::Rotate' : illegal use of explicit
template arguments
I realy appreciate your guys' help. It make me to learn c++ much more
comforably.
Shuisheng