How do you mark a struct template as friend?

前端 未结 2 1549
被撕碎了的回忆
被撕碎了的回忆 2020-12-03 15:27

I have code like this:

template  struct MyStruct {
    T aType;
    U anotherType;
};

class IWantToBeFriendsWithMyStruct
{
            


        
2条回答
  •  离开以前
    2020-12-03 15:48

    According to this site, the correct syntax would be

    class IWantToBeFriendsWithMyStruct
    {
        template  friend struct MyStruct; 
    }
    

提交回复
热议问题