From 464b6b2a5608e3226ed371f3602f5757f3b84fc4 Mon Sep 17 00:00:00 2001 From: Wim Haeck Date: Tue, 15 Oct 2024 14:34:50 -0600 Subject: [PATCH 1/3] Adding reference to the stride view iterator --- src/tools/std23/views/stride.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/std23/views/stride.hpp b/src/tools/std23/views/stride.hpp index d0cb69a..ec64226 100644 --- a/src/tools/std23/views/stride.hpp +++ b/src/tools/std23/views/stride.hpp @@ -65,6 +65,7 @@ struct stride_view : std20::ranges::view_interface< stride_view< R > > { std20::ranges::forward_range< Base >, std20::forward_iterator_tag, std20::input_iterator_tag > > >; + using reference = std20::ranges::iter_reference_t< std20::ranges::iterator_t< Base > >; iterator() = default; From 3f312ace80bd4d0cf9cf261f3457b6c67a657670 Mon Sep 17 00:00:00 2001 From: Wim Haeck Date: Tue, 15 Oct 2024 14:36:48 -0600 Subject: [PATCH 2/3] Updating test --- src/tools/std23/views/test/stride.test.cpp | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/tools/std23/views/test/stride.test.cpp b/src/tools/std23/views/test/stride.test.cpp index 332f31e..e2d438b 100644 --- a/src/tools/std23/views/test/stride.test.cpp +++ b/src/tools/std23/views/test/stride.test.cpp @@ -41,6 +41,17 @@ SCENARIO( "stride_view" ) { CHECK( std20::ranges::common_range< Range > ); } + THEN( "the stride_view range and iterator associated types are correct" ) { + + CHECK( std20::same_as< std20::ranges::range_value_t< Range >, int > ); + CHECK( std20::same_as< std20::ranges::range_reference_t< Range >, int& > ); + CHECK( std20::same_as< std20::ranges::range_difference_t< Range >, std::ptrdiff_t > ); + + CHECK( std20::same_as< std20::ranges::iter_value_t< Iterator >, int > ); + CHECK( std20::same_as< std20::ranges::iter_reference_t< Iterator >, int& > ); + CHECK( std20::same_as< std20::ranges::iter_difference_t< Iterator >, std::ptrdiff_t > ); + } + THEN( "a stride_view can be constructed and members can be tested" ) { CHECK( false == chunk.empty() ); @@ -90,6 +101,17 @@ SCENARIO( "stride_view" ) { CHECK( std20::ranges::common_range< Range > ); } + THEN( "the stride_view range and iterator associated types are correct" ) { + + CHECK( std20::same_as< std20::ranges::range_value_t< Range >, int > ); + CHECK( std20::same_as< std20::ranges::range_reference_t< Range >, int& > ); + CHECK( std20::same_as< std20::ranges::range_difference_t< Range >, std::ptrdiff_t > ); + + CHECK( std20::same_as< std20::ranges::iter_value_t< Iterator >, int > ); + CHECK( std20::same_as< std20::ranges::iter_reference_t< Iterator >, int& > ); + CHECK( std20::same_as< std20::ranges::iter_difference_t< Iterator >, std::ptrdiff_t > ); + } + THEN( "a stride_view can be constructed and members can be tested" ) { CHECK( 5 == chunk.size() ); @@ -154,6 +176,17 @@ SCENARIO( "stride_view" ) { CHECK( std20::ranges::common_range< Range > ); } + THEN( "the stride_view range and iterator associated types are correct" ) { + + CHECK( std20::same_as< std20::ranges::range_value_t< Range >, int > ); + CHECK( std20::same_as< std20::ranges::range_reference_t< Range >, int& > ); + CHECK( std20::same_as< std20::ranges::range_difference_t< Range >, std::ptrdiff_t > ); + + CHECK( std20::same_as< std20::ranges::iter_value_t< Iterator >, int > ); + CHECK( std20::same_as< std20::ranges::iter_reference_t< Iterator >, int& > ); + CHECK( std20::same_as< std20::ranges::iter_difference_t< Iterator >, std::ptrdiff_t > ); + } + THEN( "a stride_view can be constructed and members can be tested" ) { CHECK( 5 == chunk.size() ); From 9a3f83130a3dff6d3aabe9e8363541b40bd7f94a Mon Sep 17 00:00:00 2001 From: Wim Haeck Date: Tue, 15 Oct 2024 14:43:33 -0600 Subject: [PATCH 3/3] Updating release notes and tools version --- CMakeLists.txt | 2 +- ReleaseNotes.md | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aaaad2d..47d53aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ if( DEFINED PROJECT_NAME ) endif() project( tools - VERSION 0.5.0 + VERSION 0.4.1 LANGUAGES CXX ) diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 216954e..a2794d6 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,7 +1,10 @@ # Release Notes—tools Given here are some release notes for tools. -## [tools v0.5.0](https://github.com/njoy/tools/pull/xx) +## tools v0.4.1 +Bug fixes: + - iterator guards were added to the disco parser to avoid valgrind errors in ENDFtk. + - the stride_view iterator was missing the reference type, which is required to create vectors using these stride view iterators in C++17. ## [tools v0.4.0](https://github.com/njoy/tools/pull/44) New features: