Skip to content

Commit

Permalink
Fix for pybind11 2.8 API change
Browse files Browse the repository at this point in the history
  • Loading branch information
lamyj committed Oct 30, 2021
1 parent dc8d063 commit 19f9a10
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions wrappers/python/Value.cpp
Expand Up @@ -250,6 +250,7 @@ void wrap_Value(pybind11::module & m)
detail::vector_modifiers<Vector, Class_>(cl);

// vector_accessor
using T = typename Vector::value_type;
using SizeType = long; //typename Vector::size_type;
using ItType = typename Vector::iterator;

Expand All @@ -265,9 +266,14 @@ void wrap_Value(pybind11::module & m)
cl.def(
"__iter__",
[](Vector &v) {
typedef detail::iterator_state<
ItType, ItType, false, return_value_policy::copy> state;

#if PYBIND11_VERSION_HEX < 0x02080000
using state = detail::iterator_state<
ItType, ItType, false, return_value_policy::copy>;
#else
using state = detail::iterator_state<
detail::iterator_access<ItType>,
return_value_policy::copy, ItType, ItType, T>;
#endif
if (!detail::get_type_info(typeid(state), false))
{
class_<state>(handle(), "iterator", pybind11::module_local())
Expand Down

0 comments on commit 19f9a10

Please sign in to comment.