py::builtins::in¶
Defined in <pypp/builtins/in.hpp>
template <class type>
class in;
Implements Python’s in operator.
py::builtins::in implements Python’s in operator, used to
check whether a iterable contains a value.
Template parameters¶
type: The type of iterable.
Non-member helpers¶
Example¶
#include <pypp/builtins/list.hpp>
#include <pypp/builtins/in.hpp>
#include <pypp/builtins/print.hpp>
int main()
{
py::list<int> nums = {0, 1, 2, 3, 4, 5, 6};
// Equivalent to ``4 in nums`` in Python
py::print(4 ->* py::in(nums));
}
Output:
true