|
Finally, I’ll give you a version. If it’s not what you want, then I’m too lazy to say anything.
#include <iostream>
using namespace std;
template<int T1,int T2>
class One;
template<int i1,int i2, int T1, int T2>
void fun2(const One<T1,T2>&);
template<int T1,int T2>
class One
{
const static int NUM = 18;
template<int i1,int i2, int A1, int A2>
friend void fun2(const One<A1,A2>&);
};
template<int i1,int i2, int T1, int T2>
void fun2(const One<T1,T2>&)
{
cout
<< "One<" << T1 << ", "<< T2 << ">::NUM=" << (One<T1,T2>::NUM)
<< "\nviewing from\n\tfun2<" << i1 << ", "<< i2 << "," << T1 << ", "<< T2 << ">\n"<< endl;
}
int main()
{
One<1, 1> one11;
One<2, 4> one24;
fun2<2, 3>(one11);
fun2<5, 6>(one11);
fun2<7, 8>(one11);
fun2<7, 8>(one24);
} |
|