HashMap implementation

0
(0)
Nombre:
HashMap implementation
Autor: Andrew Lord (2014.02.11 16:34)
descargado: 6
Descargar:
HashMap implementation 1
hash.mqh (14.5 Kb) Vista

Descripción:

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("bajo",0);
    h.hPutInt("alto",1);

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

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

        string key = l.key();

        int j = l.valInt();

        Imprimir(key," = ",j);

    }
    delete l;

    delete h;

Recomendaciones:

  • 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.

¿De cuánta utilidad te ha parecido este contenido?

¡Haz clic en una estrella para puntuarlo!

Promedio de puntuación 0 / 5. Recuento de votos: 0

Hasta ahora, ¡no hay votos!. Sé el primero en puntuar este contenido.

¡Siento que este contenido no te haya sido útil!

¡Déjame mejorar este contenido!

Diez centavos, ¿cómo puedo mejorar este contenido?



Autor: Equipo Wiki de Forex
Somos un equipo de comerciantes de Forex altamente experimentados [2000-2023] que se dedican a vivir la vida en nuestros propios términos. Nuestro principal objetivo es lograr la independencia financiera y la libertad., y hemos buscado la autoeducación y adquirido una amplia experiencia en el mercado Forex como nuestro medio para lograr un estilo de vida autosostenible..