@@ -993,10 +993,40 @@ TEST_CASE("Collection and std iterator adaptors", "[collection][container][adapt
993993 // TODO add runtime checks here
994994 }
995995
996+ #if (__cplusplus >= 202302L)
996997 SECTION (" Const iterator" ) {
997- // C++23 required
998- DOCUMENTED_STATIC_FAILURE ((__cplusplus >= 202302L ));
998+ // iterator
999+ STATIC_REQUIRE (std::is_base_of_v<std::input_iterator_tag, std::iterator_traits<iterator>::iterator_category>);
1000+ STATIC_REQUIRE (std::input_iterator<iterator>);
1001+ // make_const_iterator(iterator) gives basic_const_iterator not our iterator or our const_iterator
1002+ STATIC_REQUIRE (std::is_same_v<std::const_iterator<iterator>, std::basic_const_iterator<iterator>>);
1003+ {
1004+ auto coll = CollectionType ();
1005+ coll.create ().cellID (42 );
1006+ auto cit = std::make_const_iterator (std::begin (coll));
1007+ REQUIRE ((*cit).cellID () == 42 );
1008+ // can't -> because iterators' -> is non-const
1009+ DOCUMENTED_STATIC_FAILURE (traits::has_member_of_pointer_v<std::const_iterator<iterator>>);
1010+ // REQUIRE(cit->cellID() == 42)
1011+ // REQUIRE(counted.base()->cellID() == 42);
1012+ }
1013+ // const_iterator
1014+ STATIC_REQUIRE (std::is_base_of_v<std::input_iterator_tag, std::iterator_traits<const_iterator>::iterator_category>);
1015+ STATIC_REQUIRE (std::input_iterator<const_iterator>);
1016+ // make_const_iterator(iterator) gives basic_const_iterator not our iterator or our const_iterator
1017+ STATIC_REQUIRE (std::is_same_v<std::const_iterator<const_iterator>, std::basic_const_iterator<const_iterator>>);
1018+ {
1019+ auto coll = CollectionType ();
1020+ coll.create ().cellID (42 );
1021+ auto cit = std::make_const_iterator (std::cbegin (coll));
1022+ REQUIRE ((*cit).cellID () == 42 );
1023+ // can't -> because const_iterators' -> is non-const
1024+ DOCUMENTED_STATIC_FAILURE (traits::has_member_of_pointer_v<std::const_iterator<const_iterator>>);
1025+ // REQUIRE(cit->cellID() == 42)
1026+ // REQUIRE(counted.base()->cellID() == 42);
1027+ }
9991028 }
1029+ #endif
10001030
10011031 SECTION (" Move iterator" ) {
10021032 // iterator
0 commit comments