NVIDIA / cuCollections

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ENHANCEMENT]: Allow cuco to accept keys that are not the same values

esoha-nvidia opened this issue · comments

Is your feature request related to a problem? Please describe.

The key that is being inserted does not necessarily have to have the same type as the values in the slots. It just has to be castable to the type that is in the slot.

Describe the solution you'd like

Modify templates so that you can insert any type that you want, so long as it can be cast to the slot type.

Describe alternatives you've considered

No response

Additional context

Test case: https://godbolt.org/z/E338375bf

The test case doesn't compile because the key that we're trying to insert, of type alt_key<Key> does not match the expected type to be inserted, which is Key.

Also note that after fixing this, you will need to change the KeyEqual function to support comparison between Key and alt_key<Key>. This is because you will be comparing a slot, which has a Key, with the thing being inserted, which is alt_key<Key>.