Results 1 to 7 of 7

Thread: Map or hash

  1. #1

    Map or hash

    Is there something in FreePascal that allows you to store and retrieve objects and give them keys ?
    I see there is a thread called 'superfast hash' but I dont see the functions
    'insert' and 'get'

  2. #2
    There should be a hashtable in contnrs.pas
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  3. #3
    Seems like delphi doesn't have it. At least not there. Some more quick datastructures in the standard library would've been nice.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  4. #4
    I downloaded one from here:http://www.benya.com/code/collections/hashtable.html

    but when I try to retrieve an object it crashes:

    this is the code im using to test the hashtable
    Code:
    s:=ship_array[0];
    hashy.setValue('trev',s);
    s:=spaceship(hashy.getValue('trev'));
    but this line causes the crash:
    Code:
    function tHashEntry.getKey : tComparable;
    begin
         result := fKey;
    end;
    Last edited by slenkar; 14-11-2010 at 11:06 PM.

  5. #5
    There is ThashedStringlist. I've used it for my latest project (non-gamedev related). It's easy to use and does the job well.

  6. #6
    Quote Originally Posted by chronozphere View Post
    Seems like delphi doesn't have it. At least not there. Some more quick datastructures in the standard library would've been nice.
    Check out the unit Generics.Collections (D2009/D2010/XE).

  7. #7
    Ah thanks. I guess I should really make the move to D2010 or XE.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •