I wish to use the key-indexing in a `Dict{X,Int}`

where `X`

is defined as the following:

```
mutable struct X
i::Int
end
import Base: isless, isequal
isless(a::X,b::X) = isless(a.i,b.i)
isequal(a::X,b::X) = isequal(a.i,b.i)
```

Then I want to use `X(6)`

as an index of a dictionary

```
DX = Dict(X(i)=>i for i=1:10)
```

### but , I cannot do this.

```
#NOTE doesn't work as expected
X6 = X(6)
DX[X6] # error
```

I got an error: key not found. However, if I retrieve the keys from `DX`

, then I got what I wanted:

```
#NOTE works
kDX = sort(collect(keys(DX)))
DX[kDX[6]]
```

### Question:

what is going on? I know it is somehow related to the hash function… But is it conceptually wrong to use `DX[X(6)]`

to retrive values?