From 5088364b967d3cf57e99d7d352b8a52230788b0c Mon Sep 17 00:00:00 2001 From: David Stone Date: Thu, 23 Apr 2020 12:47:24 -0600 Subject: [PATCH] Declare `operator==` and `operator!=` member functions const. --- include/pybind11/cast.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index fcfd0a8e3..0edc33686 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -288,8 +288,8 @@ public: // Past-the-end iterator: iterator(size_t end) : curr(end) {} public: - bool operator==(const iterator &other) { return curr.index == other.curr.index; } - bool operator!=(const iterator &other) { return curr.index != other.curr.index; } + bool operator==(const iterator &other) const { return curr.index == other.curr.index; } + bool operator!=(const iterator &other) const { return curr.index != other.curr.index; } iterator &operator++() { if (!inst->simple_layout) curr.vh += 1 + (*types)[curr.index]->holder_size_in_ptrs;