Skip to content

Supporting lambdas #14

Description

@MathieuDutSik

The code

auto fctHash=[](size_t val) -> size_t {
  return val;
};
auto fctEqual=[](size_t val1, size_t val2) -> bool {
  return val1 == val2;
};
tsl::sparse_map<size_t, int, decltype(fctHash), decltype(fctEqual)> V({}, fctHash, fctEqual);

does not compile. This is not dramatic as the following does:

std::function<size_t(size_t)> fctHash=[](size_t val) -> size_t {
  return val;
};
std::function<bool(size_t,size_t)> fctEqual=[](size_t val1, size_t val2) -> bool {
  return val1 == val2;
};
tsl::sparse_map<size_t, int, std::function<size_t(size_t)>, std::function<bool(size_t,size_t)>> V({}, fctHash, fctEqual);

but could this be addressed? This would allow better compatibility with the std::unordered_map for which tsl::sparse_map is a replacement.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions