Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

[3343] AI 1 - Problem Solving (Artificial intelligence)

Last post 07-27-2005 8:11 PM by joe.andresen. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 01-01-1999 12:00 AM

    [3343] AI 1 - Problem Solving (Artificial intelligence)

    This thread is for discussions of AI 1 - Problem Solving (Artificial intelligence).

    • Post Points: 0
  • Advertisement

    • Red Gate Software

    Advertisement

    Want to boost your .NET application performance?

    Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.

    Try it for yourself now.

  • 07-27-2005 8:11 PM In reply to

    template Linked List class errors :(

    i need help with an error im recieving.

    i have a template linked list class

    template <class LT>
    class LList
    {
    private:
     class LNode
       {
       public:
         LNode ();
         LT data;
         LNode * next;
       };

    public:
     LList();
     LList( const LList & other);
     ~LList ();
     LList & operator = (const LList & other);
     bool operator == (const LList & other);
     int Size() const;
     friend ostream & operator << <> (ostream & outs, const LList<LT> & L);
     bool InsertFirst (const LT & value);
     bool InsertLast (const LT & value);
     bool DeleteFirst ();
     bool DeleteLast ();
    private:
     LNode * first;
     int size;
    };

    and the friend function is giving me an error:

    template <class LT>
    ostream & operator << (ostream & outs, const LList<LT> & L)
    {
     if (L.first == NULL)
       return outs;

     outs << L.first -> data;

     for (LList<LT>::LNode * n = L.first -> next; n != NULL; n = n -> next)
      {
        outs << ' ' << n -> data;
      }
     return outs;
    }

    i get an error at the for loop... the error is :

    LLIST.tmp: In function `std:stream& operator<<(std:stream&, const LList<LT>&)':
    LLIST.tmp:111: error: `n' undeclared (first use this function)
    LLIST.tmp:111: error: (Each undeclared identifier is reported only once for each function it appears in.)
    LLIST.tmp:33: error: `LList<int>::LNode*LList<int>::first' is private
    LLIST.tmp:106: error: within this context
    LLIST.tmp:33: error: `LList<int>::LNode*LList<int>::first' is private
    LLIST.tmp:109: error: within this context
    application.cpp:19:   instantiated from here
    LLIST.tmp:33: error: `LList<int>::LNode*LList<int>::first' is private
    LLIST.tmp:111: error: within this context
    LLIST.tmp:111: error: dependent-name ` LList<LT>::LNode' is parsed as a non-type, but instantiation yields a type
    LLIST.tmp:111: note: say `typename  LList<LT>::LNode' if a type is meant

    i know these all have to do with friend and being private, what do i do?!?!
    • Post Points: 0
Page 1 of 1 (2 items)