-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
Binding a member function that returns a std::map does not compile, while returning a std::vector does #1515
Comments
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, |
@OndrejPopp auto& it = i.it();
auto& end = i.sen(); it should compile. But in my case using |
@roman-orekhov Ok, tx! But yes, std::map uses pairs so if that doesn't work then you still need to wrap it... btw, |
No, with |
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
The text was updated successfully, but these errors were encountered: