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
Support "in" operator for STL containers #3652
Comments
The one thing against it is that it's wrapping an operation that doesn't quite exist in the C++ STL. Obviously you can do it with something like |
Yes, but actually almost all containers support |
We support This can be implemented via a generated C++ function, one per container type. See the C++ container conversion functions in |
Just stumbled upon this. I think it's worth mentioning that C++20 added |
Thanks @jhelgert - I suspect practically we'd want to support C++97 still for this (it seems like kind of a basic feature to require C++20 for). I actually think this is easier than Scoder says and it's a very small number of template functions rather than needing generated code. I'll have a look at this sometime fairly soon. |
This is a feature request for supporting python-like "in" operator for STL containers (vector, map, etc.)
For example to test whether a set contains a value in python:
But right now similar operator in Cython is not supported:
The compiler will complain
Invalid types for 'in'
orInvalid types for 'not_in'
This is not critically necessary but it's useful
The text was updated successfully, but these errors were encountered: