SourceForge has been redesigned. Learn more.
Close

Node's order in a hashlin bucket

Help
2013-02-17
2013-02-19
  • Eugenio Pérez

    Eugenio Pérez - 2013-02-17

    Hi everybody.

    Is there any way to know the order that elements are stored in a bucket? I mean, if I have a struct like:

    struct s{
    tommy_node node;
    int key
    int a;
    }
    

    I create three variables `struct s' with a=1,2,3, and exactly the same key. After that, I save them in a tommy_hashlin, in that order. Can I assure that, when I iterate over the hashlin's bucket with tommy_hashlin_bucket, and verify that the key match, the three nodes will be shown in the same order (or, at least, in some specific order) that I introduce them?

    Thanks and regards.

     
  • Andrea Mazzoleni

    The elements with equal key/hash are always kept in the insertion order.

    Ciao,
    Andrea

     

Log in to post a comment.