Support any hash constructor in hash_test.cu::check_hash_result #520
Labels
good first issue
Good for newcomers
type: improvement
Improvement / enhancement to an existing function
I think that it would be better to not write a million of these functions. The right way to do it is with a variadic template. Also, you could make that a different PR. The code would look like this:
The
seed
is now the last argument so you need to find all occurrences ofcheck_hash_result
in this file and make the seed the last argument.After doing this change, the function will now be compatible with all hash construction.
If you want to read more about
std::forward
, these are good:The short of it is that
std::forward
written this way with a "universal reference" makes it so that this code works well when:check_hash_result(my_key, my_expected, my_seed)
. (my_seed
has a "name", it's a left-value aka l-value aka something that can be on the left side of an assignment)12345)
. (12345
has no "name", it's a right-value aka r-value aka something that can not be on the left side of an assignment statement)When used like this, the compiler will correctly optimize if the value of the
seed
or whatever is passed in there needs to be copied or moved.Originally posted by @esoha-nvidia in #514 (comment)
The text was updated successfully, but these errors were encountered: