diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f69ccb6..bb3c45d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ include(cmake/get_nwx_cmake.cmake) include(get_version_from_git) get_version_from_git(utilities_version "${CMAKE_CURRENT_LIST_DIR}") project(utilities VERSION "${utilities_version}" LANGUAGES CXX) +set(CMAKE_CXX_STANDARD 20) include(nwx_versions) include(get_cmaize) diff --git a/include/utilities/iterators/input_iterator_base.hpp b/include/utilities/iterators/input_iterator_base.hpp index 16fa0e6b..4fab4e60 100644 --- a/include/utilities/iterators/input_iterator_base.hpp +++ b/include/utilities/iterators/input_iterator_base.hpp @@ -153,7 +153,7 @@ class InputIteratorBase { * @return true if the two iterators are equal and false otherwise. * @throws None. No throw guarantee */ - bool operator==(const ParentType& rhs) const noexcept; + bool operator==(const InputIteratorBase& rhs) const noexcept; /** @brief Determines if two iterators point to different elements. * @@ -166,7 +166,7 @@ class InputIteratorBase { * @return false if the two iterators are equal and true otherwise. * @throws None. No throw guarantee */ - bool operator!=(const ParentType& rhs) const noexcept; + bool operator!=(const InputIteratorBase& rhs) const noexcept; protected: /// Downcasts this to a read-/write-able instance of the derived class @@ -187,13 +187,13 @@ ParentType InputIteratorBase::operator++(int) { template bool InputIteratorBase::operator==( - const ParentType& rhs) const noexcept { - return downcast_().are_equal(rhs); + const InputIteratorBase& rhs) const noexcept { + return downcast_().are_equal(rhs.downcast_()); } template bool InputIteratorBase::operator!=( - const ParentType& rhs) const noexcept { + const InputIteratorBase& rhs) const noexcept { return !((*this) == rhs); } diff --git a/tests/unit_tests/type_traits/type_traits_extensions.cpp b/tests/unit_tests/type_traits/type_traits_extensions.cpp index 48a9cf23..aa27ae0d 100644 --- a/tests/unit_tests/type_traits/type_traits_extensions.cpp +++ b/tests/unit_tests/type_traits/type_traits_extensions.cpp @@ -23,7 +23,7 @@ using namespace utilities; struct Struct1 { void begin(); void swap(Struct1&); - bool operator!=(const Struct1&); + bool operator!=(const Struct1&) const; int operator*(); int operator++(int); int operator[](int); @@ -34,7 +34,7 @@ struct Struct1 { }; struct Struct2 { using value_type = int; - bool operator==(const Struct2&); + bool operator==(const Struct2&) const; int operator++(); Struct2* operator->(); int operator--();