cmuparlay / parlaylib

A Toolkit for Programming Parallel Algorithms on Shared-Memory Multicore Machines
MIT License
321 stars 60 forks source link

hash_numeric fails is_monoid_for_v required for count() #70

Open csheinlen opened 9 months ago

csheinlen commented 9 months ago

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();
}