我有这样的代码:
template <typename T, typename U> struct MyStruct {
T aType;
U anotherType;
};
class IWantToBeFriendsWithMyStruct
{
friend struct MyStruct; //what is the correct syntax here ?
};
为模板赋予友谊的正确语法是什么?
What is the correct syntax to give friendship to the template ?
class IWantToBeFriendsWithMyStruct
{
template <typename T, typename U>
friend struct MyStruct;
};
在 VS2008 中工作,并允许 MyStruct 访问该类.
Works in VS2008, and allows MyStruct to access the class.
这篇关于你如何将结构模板标记为朋友?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!