py::builtins::range::find

constexpr const_iterator find(const type& value) const;

Finds the given value and returns an iterator to it, otherwise returns this->end().

Parameter

value: The value to look for.

Return value

Returns an iterator to the given value if found, otherwise this->end().

Complexity

Constant.

Example

#include <pypp/builtins/range.hpp>
#include <pypp/builtins/print.hpp>

int main()
{
    py::range<int> nums(1, 10);
    py::print(*nums.find(5));
}

Output:

5