diff --git a/include/ctpg/ctpg.hpp b/include/ctpg/ctpg.hpp index 04b46cc..c26daa2 100644 --- a/include/ctpg/ctpg.hpp +++ b/include/ctpg/ctpg.hpp @@ -124,8 +124,8 @@ namespace stdex constexpr it_type* cast() { return static_cast(this); } constexpr const it_type* cast() const { return static_cast(this); } - constexpr bool operator == (const it_type& other) const { return cast()->ptr == other.ptr; } - constexpr bool operator != (const it_type& other) const { return cast()->ptr != other.ptr; } + constexpr friend bool operator == (it_type const& a, it_type const& b) { return a.cast()->ptr == b.cast()->ptr; } + constexpr friend bool operator != (it_type const& a, it_type const& b) { return a.cast()->ptr != b.cast()->ptr; } constexpr it_type operator - (size_type amount) const { return it_type{ cast()->ptr - amount }; } constexpr size_type operator - (const it_type& other) const { return size_type(cast()->ptr - other.ptr); } constexpr it_type operator + (size_type amount) const { return it_type{ cast()->ptr + amount }; } diff --git a/tests/list_helpers.cpp b/tests/list_helpers.cpp index 2a56542..13ae722 100644 --- a/tests/list_helpers.cpp +++ b/tests/list_helpers.cpp @@ -38,6 +38,7 @@ namespace test { struct non_copyable_thing { + non_copyable_thing() = default; non_copyable_thing(const non_copyable_thing&) = delete; non_copyable_thing& operator = (const non_copyable_thing&) = delete; @@ -87,4 +88,4 @@ TEST_CASE("construct", "[list helpers]") REQUIRE(result.has_value()); REQUIRE(result.value().size() == 4); -} \ No newline at end of file +}