Open OndrejPopp opened 11 months ago
Hello, I have the same problem. Very frustrating
Good morning! Well it's not that bad... You need to write these bindings anyway so it's not too much effort to wrap the map. In addition I have found that std::optional doesn't work either, so you need to return it from the lambda as well, but without wrapping it inside sol::as_table_t because that does not make sense for a std::optional. There could be more, but I don't remember that right now, I didn't feel like commenting on it all, so I would have to look at the code. In any case, I was able to fix everything that didn't work, generally by returning it from a lambda. So that's not all that bad...
Oh yeah, there is an other thing, from the top of my head, if I remember correctly, optional parameters in a constructor do not work either so you need to expand those. For example, if you have T::T(t1 a, t2 b, t3 c = d) you need to expand that into, sol::constructors<T(t1 a, t2 b),T(t1 a, t2 b, t3 c)>() and so on if you have more optional parameters in your constructor.
For the rest, it works like a charm, tx PhD!
@OndrejPopp you can fix the offending lines like this
auto& it = i.it();
auto& end = i.sen();
it should compile. But in my case using pairs
doesn't actually run through the std::map
anyway.
@roman-orekhov Ok, tx! But yes, std::map uses pairs so if that doesn't work then you still need to wrap it...
btw, it.sen() should be it.end() ?
No, with it.end()
it won't compile. sen
in from sentinel
Ok. Tx.
Hello, here I am again! And this time with a Phd test case, ThePhd.h.txt
As commented here above, while trying to bind the Phd, binding thePhdVector does compile, while binding thePhdMap does not. However, when you wrap that inside a sol::as_table_t it does compile, which is a good workaround, but I think the standard binding should work as well for the Phd?
And here is the compiler trace, thePhdTrace.txt
It appears to be failing around here,
Ok, that was my Phd test case :) Tx, and have a nice day, Ondrej