Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
m-fila committed Dec 20, 2024
1 parent f1f0aeb commit 2af7ea5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions doc/collections_as_container.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ In the following tables a convention from `Collection` is used: `iterator` stand
| `std::random_access_iterator` | ✔️ yes | ✔️ yes |
| `std::contiguous_iterator` | ❌ no | ❌ no |

> [!NOTE]
>The collections' iterators fulfil the `std::forward_iterator` except that the pointers obtained with `->` remain valid only as long as the iterator is valid instead of as long as the range remain valid. In practice this means a `ptr` obtained with `auto* ptr = it.operator->();` is valid only as long as `it` is valid.
> [!NOTE]
>The collections' iterators fulfil the `std::forward_iterator` except that the pointers obtained with `->` remain valid only as long as the iterator is valid instead of as long as the range remain valid. In practice this means a `ptr` obtained with `auto* ptr = it.operator->();` is valid only as long as `it` is valid.
>The values obtained immediately through `->` (for instance `auto& e = it->energy();`) behaves as expected for `std::forward_iterator` as their validity is tied to the validity of a collection.
### LegacyIterator
Expand Down
2 changes: 1 addition & 1 deletion python/templates/Collection.h.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public:
}
const_reverse_iterator crend() const {
return rend();
}
}


{% for member in Members %}
Expand Down
4 changes: 2 additions & 2 deletions tests/unittests/std_interoperability.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,10 +743,10 @@ TEST_CASE("Collection and unsupported iterator concepts", "[collection][containe
DOCUMENTED_STATIC_FAILURE(std::output_iterator<const_iterator, CollectionType::mutable_type>);
// std::contiguous_iterator
DOCUMENTED_STATIC_FAILURE(std::is_lvalue_reference_v<iterator::reference>);
DOCUMENTED_STATIC_FAILURE(std::same_as<iterator::value_type, std::remove_cvref_t<iterator::reference>>);
DOCUMENTED_STATIC_FAILURE(std::same_as<iterator::value_type, std::remove_cvref_t<iterator::reference>>);
DOCUMENTED_STATIC_FAILURE(std::contiguous_iterator<iterator>);
DOCUMENTED_STATIC_FAILURE(std::is_lvalue_reference_v<const_iterator::reference>);
STATIC_REQUIRE(std::same_as<const_iterator::value_type, std::remove_cvref_t<const_iterator::reference>>);
STATIC_REQUIRE(std::same_as<const_iterator::value_type, std::remove_cvref_t<const_iterator::reference>>);
DOCUMENTED_STATIC_FAILURE(std::contiguous_iterator<const_iterator>);
}
#endif // __cplusplus >= 202002L
Expand Down
1 change: 0 additions & 1 deletion tests/unittests/unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ TEST_CASE("Reverse iterators", "[basics]") {
REQUIRE((*++it).energy() == 42);
}


TEST_CASE("Notebook", "[basics]") {
auto hits = ExampleHitCollection();
for (unsigned i = 0; i < 12; ++i) {
Expand Down

0 comments on commit 2af7ea5

Please sign in to comment.