Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HashMap compile error #235

Open
yinengy opened this issue Jun 7, 2023 · 0 comments
Open

HashMap compile error #235

yinengy opened this issue Jun 7, 2023 · 0 comments

Comments

@yinengy
Copy link

yinengy commented Jun 7, 2023

include/shad/data_structures/local_hashmap.h:1078:31: error: no match for call to '(agile::wk2_exact::intTimeInserter<long int>) (shad::rt::Handle&, long int*, const long int&, bool)'
 1078 |         bool inserted = insfun(handle, &entry->value, value, false);
      |                         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from wk2_exact/pattern.cc:47:
include/agile/wk2_exact/pattern.h:56:8: note: candidate: 'bool agile::wk2_exact::intTimeInserter<T>::operator()(T*, const T&, bool) [with T = long int]'
   56 |   bool operator()(T * const lhs, const T & rhs, bool same_key) {
      |        ^~~~~~~~
include/agile/wk2_exact/pattern.h:56:8: note:   candidate expects 3 arguments, 4 provided

Get this compiling error from latest code.

My inserter is code is

template <typename T>
struct intTimeInserter {
  intTimeInserter() { }

  bool operator()(T * const lhs, const T & rhs, bool same_key) {
    if (same_key) {     // entry in hashmap, value = min(current value, new value)
       if (* lhs > rhs) * lhs = rhs;
    } else {            // entry not in hashmap, value = new value
       * lhs = rhs;
    }

    return true;
  }

  bool Insert(T *const lhs, const T &rhs, bool same_key) {
    if (same_key) {     // entry in hashmap, value = minimum(current value, new value)
       if (* lhs > rhs) * lhs = rhs;
    } else {            // entry not in hashmap, value = new value
       * lhs = rhs;
    }
       
    return true;
  }
};

Looks like the required signature changes, how should the inserter code be fixed to work with the new changes?

Looks like from recent commit 0805ea1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant