I was pointed here by an old documentation writer for emscripten so I hope
this is the right forum!
While creating a priority queue with emscripten::val's. I'm running into
trouble when I insert elements.
Error
c:\Emscripten\emscripten\1.37.9\system\include\libcxx\__functional_base:61:21:
error: invalid operands to binary expression ('const emscripten::val' and
'const emscripten::val') {return __x < __y;}
The priority queue uses a binary operator, which according to the val.h has
not yet been implemented yet. (line 268
https://chromium.googlesource.com/external/github.com/kripken/emscripten/+/1.35.20/system/include/emscripten/val.h
)
Below is the full sample used to create the error.
`
#include
#include
#include <emscripten/bind.h>
using namespace emscripten;
void (std::priority_queue::*push)(const val&) = &std::priority_queue::push;
EMSCRIPTEN_BINDINGS(my_stack) {
class_<std::priority_queue>("MyStack")
.constructor<>()
.function("push", push)
.function("top", &std::priority_queue::top)
.function("size", &std::priority_queue::size)
.function("empty", &std::priority_queue::empty);
}
`
I have tried creating a comparator function for the container but have had
no success. Is there a way to sort the emscripten vals with my own
comparators? Do I have to define my own binary operator on the class to do
any form of sorted container? I've think I've tried this in one form or
another - is it my c++ or am I missing something?
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.