File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,38 @@ namespace py = pybind11;
1818using TagIterator = osmium::TagList::const_iterator;
1919using MemberIterator = osmium::RelationMemberList::const_iterator;
2020
21+ #if PYBIND11_VERSION_MINOR >= 11 || PYBIND11_VERSION_MAJOR > 2
22+ /*
23+ Work-around false positive added by pybind/pybind11@f701654 change:
24+ ItemIterator/CollectionIterator ARE copy/move constructible, even if their template
25+ parameter is not. Indeed, those iterators iterate over low-level memory representation
26+ of the objects, without relying on their constructors.
27+
28+ For eg.
29+ // static_assert(std::is_move_constructible<osmium::memory::CollectionIterator<osmium::RelationMember const>>::value);
30+ // static_assert(!std::is_copy_constructible<osmium::RelationMember>::value);
31+
32+ The work-around relies on officially exposed pybind11::detail::is_copy_constructible/is_copy_constructible:
33+ https://github.com/pybind/pybind11/pull/4631
34+ */
35+ namespace pybind11 {
36+ namespace detail {
37+ template <typename T>
38+ struct is_copy_constructible <osmium::memory::CollectionIterator<T>>
39+ : std::true_type {};
40+ template <typename T>
41+ struct is_move_constructible <osmium::memory::CollectionIterator<T>>
42+ : std::true_type {};
43+ template <typename T>
44+ struct is_copy_constructible <osmium::memory::ItemIterator<T>>
45+ : std::true_type {};
46+ template <typename T>
47+ struct is_move_constructible <osmium::memory::ItemIterator<T>>
48+ : std::true_type {};
49+ } // namespace detail
50+ } // namespace pybind11
51+ #endif
52+
2153static py::object tag_iterator_next (TagIterator &it, TagIterator const &cend)
2254{
2355 if (it == cend)
You can’t perform that action at this time.
0 commit comments