parlaylib icon indicating copy to clipboard operation
parlaylib copied to clipboard

hash_numeric fails is_monoid_for_v required for count()

Open csheinlen opened this issue 1 year ago • 0 comments

I took the code from your hashtable tests and added a final call to count(). Without that last line it compiles without any issue, but including table.count() triggers this assertion failure:

include/parlay/internal/sequence_ops.h:192:17: error: static assertion failed
  192 |   static_assert(is_monoid_for_v<Monoid, range_reference_type_t<Seq>>);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int main(int argc, char* argv[]) {

    parlay::hashtable<parlay::hash_numeric<int>>
    table(400000, parlay::hash_numeric<int>{});;

    parlay::parallel_for(1, 100000, [&](int i) {
      table.insert(i);
    });

    size_t cnt = table.count();
}

csheinlen avatar Feb 02 '24 16:02 csheinlen