我有这样的代码:
templatestruct MyStruct { T aType; U anotherType; }; class IWantToBeFriendsWithMyStruct { friend struct MyStruct; //what is the correct syntax here ? };
为模板提供友谊的正确语法是什么?
class IWantToBeFriendsWithMyStruct { templatefriend struct MyStruct; };
适用于VS2008,允许MyStruct访问该类.
根据这个网站,正确的语法将是
class IWantToBeFriendsWithMyStruct { templatefriend struct MyStruct; }