-
Notifications
You must be signed in to change notification settings - Fork 2.2k
variant_caster cant handle c++ type nullptr_t #839
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
Comments
i only start learn template magic, but i fix this error by specializing template for nullptr_t via SFINAE(it is correct name for this trick?) :
Test: c++
python
Test result:
|
Should be fixed in #840. The underlying issue is in |
I do not understand completely, but do not the types differ? (double* and nullptr_t). |
They are different types in C++ at compile time, but when converting at run time from Python's |
Then can you give preference to |
I was looking into it, but it ends up being a bit complicated because we only have two priority levels and those are already divided into |
I think I'm missing something--how does |
Perhaps we could solve this by treating I did try severing this in The other solution—and actually, I think this makes logical sense even with the above—is to change the various type casters to make loading if (src.is_none()) {
value = nullptr;
return true;
} we do: if (src.is_none()) {
if (!convert) return false;
value = nullptr;
return true;
} Then the |
Yeah, that's what I had in mind for giving |
* Fix compilation error with std::nullptr_t * Enable conversion from None to std::nullptr_t and std::nullopt_t Fixes #839.
I have compile errors while compile this code (gcc 7.1 and vs 2017 checked)
gcc output:
msvc 2017 output:
The text was updated successfully, but these errors were encountered: