It's more for the novelty than performance. If I'm hearing your right I 
should keep the type of priority queue a coercable type from val so I can 
use operators? I will give this a shot thanks.

On Monday, March 5, 2018 at 4:18:57 PM UTC-8, Charles Vaughn wrote:
>
> So first of all, I'd say you're not going to want to use val for anything 
> remotely performance sensitive. There's a lot of overhead marshalling 
> values back and forth.
>
> Directly to your point, val can represent any javascript value, including 
> those for which comparator operators don't make sense. For example 3 < 
> {'foo':'bar'}. You'll want to cast your val type to the underlying key of 
> your priority queue.
>
> On Tuesday, February 27, 2018 at 11:01:26 PM UTC-8, michael dalton wrote:
>>
>> 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 emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to