Skip to content

Commit

Permalink
Merge branch 'feature/std23-reference' into 'develop'
Browse files Browse the repository at this point in the history
Feature/std23 reference

See merge request njoy/tools!4
  • Loading branch information
whaeck committed Oct 15, 2024
2 parents 6ab7fc8 + 9a3f831 commit af689a4
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if( DEFINED PROJECT_NAME )
endif()

project( tools
VERSION 0.5.0
VERSION 0.4.1
LANGUAGES CXX
)

Expand Down
5 changes: 4 additions & 1 deletion ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
1 change: 1 addition & 0 deletions src/tools/std23/views/stride.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
33 changes: 33 additions & 0 deletions src/tools/std23/views/test/stride.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down Expand Up @@ -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() );
Expand Down Expand Up @@ -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() );
Expand Down

0 comments on commit af689a4

Please sign in to comment.