Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / opensfm / 0004-pybind_utils.h-conflicts-with-nixpkgs-pybind.patch
blobf3cb2db00ecbca5d47e88f4393aa88afc046708f
1 From c35b110a83286e7413d7309eb218eb43b52f7d48 Mon Sep 17 00:00:00 2001
2 From: Someone Serge <sergei.kozlukov@aalto.fi>
3 Date: Sat, 19 Feb 2022 14:36:12 +0200
4 Subject: [PATCH 4/4] pybind_utils.h: conflicts with nixpkgs' pybind
6 ---
7 opensfm/src/map/pybind_utils.h | 45 +++-------------------------------
8 1 file changed, 3 insertions(+), 42 deletions(-)
10 diff --git a/opensfm/src/map/pybind_utils.h b/opensfm/src/map/pybind_utils.h
11 index 817d1a16..3f98a2ab 100644
12 --- a/opensfm/src/map/pybind_utils.h
13 +++ b/opensfm/src/map/pybind_utils.h
14 @@ -52,38 +52,6 @@ struct sfm_iterator_state {
16 PYBIND11_NAMESPACE_END_(detail)
18 -/// Makes an python iterator over the keys (`.first`) of a iterator over pairs
19 -/// from a first and past-the-end InputIterator.
20 -template <return_value_policy Policy = return_value_policy::reference_internal,
21 - typename Iterator, typename Sentinel,
22 - typename KeyType = decltype((*std::declval<Iterator>()).second),
23 - typename... Extra>
24 -iterator make_value_iterator(Iterator first, Sentinel last, Extra &&... extra) {
25 - typedef detail::sfm_iterator_state<Iterator, Sentinel, detail::RefIterator,
26 - Policy>
27 - state;
29 - if (!detail::get_type_info(typeid(state), false)) {
30 - class_<state>(handle(), "iterator", pybind11::module_local())
31 - .def("__iter__", [](state &s) -> state & { return s; })
32 - .def("__next__",
33 - [](state &s) -> KeyType {
34 - if (!s.first_or_done)
35 - ++s.it;
36 - else
37 - s.first_or_done = false;
38 - if (s.it == s.end) {
39 - s.first_or_done = true;
40 - throw stop_iteration();
41 - }
42 - return (*s.it).second;
43 - },
44 - std::forward<Extra>(extra)..., Policy);
45 - }
47 - return cast(state{first, last, true});
50 template <return_value_policy Policy = return_value_policy::reference_internal,
51 typename Iterator, typename Sentinel,
52 typename KeyType = decltype(&((*std::declval<Iterator>()).second)),
53 @@ -148,12 +116,13 @@ iterator make_ref_iterator(Iterator first, Sentinel last, Extra &&... extra) {
56 /// Makes a python iterator from a first and past-the-end C++ InputIterator.
57 -template <return_value_policy Policy = return_value_policy::reference_internal,
58 +template <typename Access,
59 + return_value_policy Policy = return_value_policy::reference_internal,
60 typename Iterator, typename Sentinel,
61 typename ValueType = decltype(std::declval<Iterator>()),
62 typename... Extra>
63 iterator make_ptr_iterator(Iterator first, Sentinel last, Extra &&... extra) {
64 - typedef detail::iterator_state<Iterator, Sentinel, false, Policy> state;
65 + typedef detail::iterator_state<Access, Policy, Iterator, Sentinel, ValueType, Extra...> state;
67 if (!detail::get_type_info(typeid(state), false)) {
68 class_<state>(handle(), "iterator", pybind11::module_local())
69 @@ -176,14 +145,6 @@ iterator make_ptr_iterator(Iterator first, Sentinel last, Extra &&... extra) {
70 return cast(state{first, last, true});
73 -/// Makes an iterator over the keys (`.first`) of a stl map-like container
74 -/// supporting `std::begin()`/`std::end()`
75 -template <return_value_policy Policy = return_value_policy::reference_internal,
76 - typename Type, typename... Extra>
77 -iterator make_value_iterator(Type &value, Extra &&... extra) {
78 - return make_value_iterator<Policy>(std::begin(value), std::end(value),
79 - extra...);
81 template <return_value_policy Policy = return_value_policy::reference_internal,
82 typename Type, typename... Extra>
83 iterator make_unique_ptr_value_iterator(Type &value, Extra &&... extra) {
84 --
85 2.33.1