HashMap implementation

0
(0)
Naam:
HashMap implementation
Skrywer: Andrew Lord (2014.02.11 16:34)
Afgelaai: 6
Aflaai:
HashMap implementation 1
hash.mqh (14.5 Kb) Beskou

Beskrywing:

This is a HashMap implementation. This allows something like arrays but with string indexes. It maps strings to Objects. The Objects must be a subclass of the HashValue class provided.

The Hash by default will 'adopt' the value objects. In which case it will free the memory when they are no longer in the hash. This can be disabled in the constructor.

Here is an example:

 

    
    Hash *h = new Hash();

    // Store values
    h.hPutInt("laag",0);
    h.hPutInt("hoog",1);

    // Get values
    int high = h.gGetInt("hoog");

    // Loop
    HashLoop *l ;
    vir( l = new HashLoop(h) ; l.hasNext() ; l.next()) {

        string key = l.key();

        int j = l.valInt();

        Print(key," = ",j);

    }
    delete l;

    delete h;

Aanbevelings:

  • Accompany the submitted code with a meaning-bearing name and a brief description.
  • Attach a brief explanation to the code for users to make head or tail of it.
  • Insert illustrating images where applicable.

Hoe nuttig was hierdie pos nie?

Klik op 'n ster om dit te gradeer!

Gemiddelde gradering 0 / 5. Stemmetelling: 0

Geen stemme tot dusver nie! Wees die eerste om hierdie plasing te beoordeel.

Ons is jammer dat hierdie plasing nie vir jou nuttig was nie!

Kom ons verbeter hierdie pos!

Vertel ons hoe ons hierdie pos kan verbeter?



Skrywer: Forex Wiki-span
Ons is 'n span hoogs ervare Forex Handelaars [2000-2023] wat daaraan toegewy is om die lewe op ons eie terme te leef. Ons primêre doelwit is om finansiële onafhanklikheid en vryheid te verkry, en ons het selfonderrig nagestreef en uitgebreide ondervinding in die Forex-mark opgedoen as ons manier om 'n selfvolhoubare leefstyl te bereik.