Thread: implementing a stack with template

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    82
    Presumably in your char-pointer stack class you would have a member of type TArray

    Something like:
    Code:
    // CHAR_PTR_STACK.H
    
    #include "T_ARRAY_FILE"
    
    class CharStack {
    
       private:
          TArray<char*> myStackData  // array holds char* elements
    
          // ....
    }
    Last edited by AH_Tze; 03-31-2005 at 06:31 PM.

  2. #2
    Registered User
    Join Date
    Aug 2002
    Location
    Hermosa Beach, CA
    Posts
    446
    Or for any type T:

    Code:
    template <class T>
    class Stack {
    
       private:
          TArray<T> myStackData 
    
          // ....
    }
    The crows maintain that a single crow could destroy the heavens. Doubtless this is so. But it proves nothing against the heavens, for the heavens signify simply: the impossibility of crows.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. stack and pointer problem
    By ramaadhitia in forum C Programming
    Replies: 2
    Last Post: 09-11-2006, 11:41 PM
  3. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  4. infix evaluation using stack
    By lewissi in forum C++ Programming
    Replies: 0
    Last Post: 11-03-2005, 02:56 AM
  5. oh me oh my hash maps up the wazoo
    By DarkDays in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 12:54 PM