simple template friend question

This is a discussion on simple template friend question within the C++ Programming forums, part of the General Programming Boards category; Here is the top of my class Code: template < class T > class TODLLNode { friend class TODLList; Whenever ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    27

    simple template friend question

    Here is the top of my class

    Code:
    template < class T >
    class TODLLNode
    {
      friend class TODLList;
    Whenever I try to intialize anything in a test function I get the error

    todllnode.templ:16: error: template argument required for 'struct TODLList'

    What am I doing wrong?

    If it helps...

    My private variables are as follows:

    private:
    T data_;
    TODLLNode < T > * fore_;
    TODLLNode < T > * back_;



    Here is a simple initializing of a variable to get this error in my test function

    TODLLNode < int > a;
    Last edited by noodle24; 06-02-2006 at 11:40 AM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,744
    Why not post the smallest and simplest piece of code that demonstrates the error?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    Unless I miss my guess TODLList is a template and you'll want to make
    Code:
    friend class TODLList;
    ->
    Code:
    friend class TODLList<T>;
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Specialising a member function with a template template parameter
    By the4thamigo_uk in forum C++ Programming
    Replies: 10
    Last Post: 10-12-2007, 04:37 AM
  2. friend question
    By black in forum C++ Programming
    Replies: 6
    Last Post: 08-03-2004, 05:55 AM
  3. Template Question
    By Eber Kain in forum C++ Programming
    Replies: 5
    Last Post: 06-12-2004, 10:07 PM
  4. function template question
    By Thantos in forum C++ Programming
    Replies: 3
    Last Post: 04-18-2004, 10:40 AM
  5. question about .net to 6.0 change causing errors
    By jverkoey in forum C++ Programming
    Replies: 17
    Last Post: 03-23-2004, 09:45 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21