diff --git a/doc/collections_as_container.md b/doc/collections_as_container.md index 6bac69019..090ee5d19 100644 --- a/doc/collections_as_container.md +++ b/doc/collections_as_container.md @@ -121,11 +121,14 @@ The C++ specifies a set of named requirements for iterators. Starting with C++20 ### LegacyForwardIterator +In addition to the *LegacyForwardIterator* the C++ standard specifies also the *mutable LegacyForwardIterator*, which is both *LegacyForwardIterator* and *LegacyOutputIterator*. The term **mutable** used in this context doesn't imply mutability in the sense used in the PODIO. + + | Requirement | Fulfilled by `iterator`/`const_iterator`? | Comment | |-------------|-------------------------------------------|---------| | [*LegacyInputIterator*](https://en.cppreference.com/w/cpp/named_req/InputIterator) | ❌ no / ❌ no | [See above](#legacyinputiterator)| | [*DefaultConstructible*](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible) | ❌ no / ❌ no | Value initialization not defined | -| If mutable iterator then `reference` same as `value_type&` or `value_type&&`, otherwise same as `const value_type&` or `const value_type&&` | ❌ no / ❌ no | `reference` and `value_type` not defined | +| If *mutable* iterator then `reference` same as `value_type&` or `value_type&&`, otherwise same as `const value_type&` or `const value_type&&` | ❌ no / ❌ no | `reference` and `value_type` not defined | | [Multipass guarantee](https://en.cppreference.com/w/cpp/named_req/ForwardIterator) | ❌ no / ❌ no | Copy constructor not defined | | [Singular iterators](https://en.cppreference.com/w/cpp/named_req/ForwardIterator) | ❌ no / ❌ no | Value initialization not defined | diff --git a/tests/unittests/std_interoperability.cpp b/tests/unittests/std_interoperability.cpp index df9b1eefd..ab6fd35d9 100644 --- a/tests/unittests/std_interoperability.cpp +++ b/tests/unittests/std_interoperability.cpp @@ -590,14 +590,33 @@ TEST_CASE("Collection iterators", "[collection][container][iterator][std]") { } // end of LegacyInputIterator - // Mutable iterator: reference same as value_type& or value_type&& + // Mutable LegacyForwardIterator (LegacyForwardIterator that is also LegacyOutputIterator): + // - reference same as value_type& or value_type&& + // iterator DOCUMENTED_STATIC_FAILURE(traits::has_reference_v); DOCUMENTED_STATIC_FAILURE(traits::has_value_type_v); // STATIC_REQUIRE( // std::is_same_v::reference, std::iterator_traits::value_type&> || // std::is_same_v::reference, std::iterator_traits::value_type&&>); + // const_iterator + DOCUMENTED_STATIC_FAILURE(traits::has_reference_v); + DOCUMENTED_STATIC_FAILURE(traits::has_value_type_v); + // STATIC_REQUIRE( + // std::is_same_v::reference, + // std::iterator_traits::value_type&> || + // std::is_same_v::reference, + // std::iterator_traits::value_type&&>); - // Immutable iterator: reference same as const value_type& or const value_type&& + // (Immutable) iterator: + // - reference same as const value_type& or const value_type&& + // iterator + DOCUMENTED_STATIC_FAILURE(traits::has_reference_v); + DOCUMENTED_STATIC_FAILURE(traits::has_value_type_v); + // STATIC_REQUIRE(std::is_same_v::reference, + // const std::iterator_traits::value_type&> || + // std::is_same_v::reference, + // const std::iterator_traits::value_type&&>); + // const_iterator DOCUMENTED_STATIC_FAILURE(traits::has_reference_v); DOCUMENTED_STATIC_FAILURE(traits::has_value_type_v); // STATIC_REQUIRE(std::is_same_v::reference,