py::builtins::operator ->* (py::builtins::in)

Defined in <pypp/builtins/min.hpp>

template <class element_t, class container_t>
bool operator ->* (const element_t& element, const in<container_t>& container);

Returns whether a iterable object contains a value.

Template parameters

element_t: Type of the value to find.

container_t: Type of the container.

Parameters

element: The value to find.

container: An py::builtins::in object referencing an iterable object.

Return value

Whether a iterable object contains a value.

Complexity

Linear in the size of container.container().

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