Доброго дня !
Вкратце, есть такой код, это то, чего хотелось бы добиться:
| Код | #include <stdio.h> #include <conio.h> #include <iostream> using namespace std;
template< class T > class A { public: A( ){ }
template< int iDistance > void Method( ); //Должен быть реализован вне класса
private: };
template< class T > template< int iDistance > void A<T>::Method<iDistance>( ) { } // I cause here an error
void main( ) { A<int> a;
a.Method<5>( );
getch( ); }
|
Вылазит ошибка: error C2768: 'A<T>::Method' : illegal use of explicit template arguments
Так тоже не работает:
| Код | template< class T, int iDistance > void A<T>::Method<iDistance>( ) {
}
|
Как провернуть задуманное ?
|