Thread: hetrogenous linked list

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    113

    hetrogenous linked list

    I have found from an ebook that we can maintain links between hetrogenous elements by void pointer.But then how we will be able to derefrence it since, derefrencing void pointer is illegal and also we do not know the type of node at prior to runtime.

  2. #2
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    Did the book said you can?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    There are a few ways to build heterogeneous containers. It involves a few tricks obviously. As you realized, it can't be done in a simple way.

    http://www.acims.arizona.edu/EDUCATION/HCCL/

    However, if you are trying to hold elements in a linked list pointing to a base hierarchy, you can effectively hold any of the derived types without the need to resort to pointers to void.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ Linked list program need help !!!
    By dcoll025 in forum C++ Programming
    Replies: 1
    Last Post: 04-20-2009, 10:03 AM
  2. Following CTools
    By EstateMatt in forum C Programming
    Replies: 5
    Last Post: 06-26-2008, 10:10 AM
  3. Adding directory/file names to a linked list
    By thoseion in forum C Programming
    Replies: 13
    Last Post: 12-08-2006, 01:13 PM
  4. Template Class for Linked List
    By pecymanski in forum C++ Programming
    Replies: 2
    Last Post: 12-04-2001, 09:07 PM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 10:21 PM