[PATCH v2 2/2] libcamera: utils: StringSplitter: Add `operator==`
Barnabás Pőcze
pobrn at protonmail.com
Thu Dec 5 10:23:06 CET 2024
If `cpp_debugstl` is enabled in the build configuration, then
libstdc++ will try to use `==` on operators in certain cases
to carry out extra checks. This leads to build failures because
`StringSplitter::iterator` has no `operator==`.
Implement `operator==`, and express `operator!=` in terms of it.
Signed-off-by: Barnabás Pőcze <pobrn at protonmail.com>
---
include/libcamera/base/utils.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h
index c4a06660..780aeda6 100644
--- a/include/libcamera/base/utils.h
+++ b/include/libcamera/base/utils.h
@@ -205,9 +205,14 @@ public:
iterator &operator++();
std::string operator*() const;
+ bool operator==(const iterator &other) const
+ {
+ return pos_ == other.pos_;
+ }
+
bool operator!=(const iterator &other) const
{
- return pos_ != other.pos_;
+ return !(*this == other);
}
private:
--
2.47.1
More information about the libcamera-devel
mailing list