Hi everyone : ) 
    
    
    type
      ComponentPoint* = object
        point: int
        id: int
    
    ## I want to calculate hash by only one variable
    proc hash(x: ComponentPoint): Hash =
      result = x.id
    
    var pp = ComponentPoint()
    pp.id = 1000
    pp.point = 1000
    var pp2 = ComponentPoint()
    pp2.id = 1000
    pp2.point = 0
    
    var hset= initHashSet[ComponentPoint](512)
    hset.incl(pp)
    
    # I suppose it must be true as the hashes are equal, but it's false
    assert pp2 in sss == true
    
    
    Run

What's wrong with my code? ( Aside of primitive hash proc ) the thing is that 
is I set pp2.point to 1000 it gives the true. But Then I don't understand how 
things work under the hood. I thought that there is hash check and it must be 
valid.

Reply via email to