From b24e485aeeefb80d64398ed93284ee2f72bbe993 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Mon, 17 Nov 2025 21:52:35 -0600 Subject: [PATCH 1/2] adds cxx20 support --- CMakeLists.txt | 1 + tests/unit_tests/type_traits/type_traits_extensions.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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/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--(); From 21bc68e1224538553eb0bf3f53c98c4e5537d2a1 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Mon, 17 Nov 2025 22:13:47 -0600 Subject: [PATCH 2/2] fix input iterator --- include/utilities/iterators/input_iterator_base.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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); }