Skip to content

Add missing template parameters to register_map and register_vector #23625

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

Merged
merged 3 commits into from
Feb 15, 2025

Conversation

tikoyes94
Copy link
Contributor

@tikoyes94 tikoyes94 commented Feb 8, 2025

Add missing template args to register_map and register_vector to allow this kind of bindings:

#include <emscripten.h>
#include <emscripten/bind.h>

std::map<std::string, std::string, std::greater<std::string>> get_map() {
  std::map<std::string, std::string, std::greater<std::string>> m;
  m["a"] = "b";
  m["c"] = "d";
  return m;
}

EMSCRIPTEN_BINDINGS(test_map) {
  emscripten::register_map<std::string, std::string, std::greater<std::string>>("StringMap");
  emscripten::function("get_map", &get_map);
}

@sbc100 sbc100 requested a review from brendandahl February 8, 2025 14:22
@brendandahl brendandahl merged commit 2e2ec08 into emscripten-core:main Feb 15, 2025
27 checks passed
@tikoyes94 tikoyes94 deleted the register-map-with-compare branch February 16, 2025 04:54
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

Successfully merging this pull request may close these issues.

2 participants