stotko / stdgpu

stdgpu: Efficient STL-like Data Structures on the GPU
https://stotko.github.io/stdgpu/
Apache License 2.0
1.16k stars 83 forks source link

functional: Make hash more SFINAE-friendly and improve error messages #384

Closed stotko closed 1 year ago

stotko commented 1 year ago

The hash function object from functional is currently only defined for specializations and will result in a compile error otherwise. However, this compiler error is not very informative (see #374) and does not provide any hints about a missing specialization when used with custom types. Make hash always and disable all constructors for non-specialized types to follow the C++ standard more closely. Furthermore, improve the error messages in such cases by adding additional compile-time checks in unordered_map and unordered_set.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (230a79d) 97.36% compared to head (438fa1d) 97.36%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #384 +/- ## ======================================= Coverage 97.36% 97.36% ======================================= Files 31 31 Lines 2547 2547 ======================================= Hits 2480 2480 Misses 67 67 ``` | [Impacted Files](https://app.codecov.io/gh/stotko/stdgpu/pull/384?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Patrick+Stotko) | Coverage Δ | | |---|---|---| | [src/stdgpu/unordered\_map.cuh](https://app.codecov.io/gh/stotko/stdgpu/pull/384?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Patrick+Stotko#diff-c3JjL3N0ZGdwdS91bm9yZGVyZWRfbWFwLmN1aA==) | `100.00% <ø> (ø)` | | | [src/stdgpu/unordered\_set.cuh](https://app.codecov.io/gh/stotko/stdgpu/pull/384?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Patrick+Stotko#diff-c3JjL3N0ZGdwdS91bm9yZGVyZWRfc2V0LmN1aA==) | `100.00% <ø> (ø)` | | | [src/stdgpu/impl/functional\_detail.h](https://app.codecov.io/gh/stotko/stdgpu/pull/384?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Patrick+Stotko#diff-c3JjL3N0ZGdwdS9pbXBsL2Z1bmN0aW9uYWxfZGV0YWlsLmg=) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.