Compiler error in declaring template friend class within a template class

前端 未结 2 1912
名媛妹妹
名媛妹妹 2021-02-20 00:01

I have been trying to implement my own linked list class for didactic purposes.

I specified the \"List\" class as friend inside the Iterator declaration, but it doesn\'t

2条回答
  •  你的背包
    2021-02-20 00:51

    try adding a forward declaration

    template  class List;
    

    at the start of Iterator.h -- that might be what you need to allow the friend declaration inside the Iterator class to work.

提交回复
热议问题