Здравствуйте, Аноним, Вы писали:
А>Можно ли объявить дружественную шаблонную функцию?
class Access
{
template<class T>
friend
void access_func(T);
static void internal() {}
};
template<class T>
void access_func(T ) { Access::internal(); }
Можно ли объявить дружественную шаблонную функцию?
То есть что-то типа
class Access
{
friend
template<class T> // error C2059: syntax error : ''template<''
void access_func(T);
static void internal() {}
};
template<class T>
void access_func(T ) { Access::internal(); }
Не работает даже такой вариант
template<class T>
class Access
{
friend void access_func(T);
static void internal() {}
};
template<class T>
void access_func(T ) { Access<T>::internal(); } // error C2248: 'Access<T>::internal' : cannot access private member declared in class 'Access<T>'
Здравствуйте, Bell, Вы писали:
B>Здравствуйте, Аноним, Вы писали:
А>>Можно ли объявить дружественную шаблонную функцию?
B>B>class Access
B>{
B> template<class T>
B> friend
B> void access_func(T);
B> static void internal() {}
B>};
B>template<class T>
B>void access_func(T ) { Access::internal(); }
B>
Спасибо!