#29 Compilation error on bp::indexing::vector_suite

open
nobody
None
5
2011-08-18
2011-08-18
Jason Kankiewicz
No

When using Boost.Python indexing suite v.2 to expose an instantiation of std::vector<X> where class X doesn't have a "<" operator, Py++ isn't generating an instantiation of bp::indexing::vector_suite with a MethodMask template parameter whose bitmask value excludes boost::python::indexing::method_sort. In fact, the instantiation code it generates doesn't include a MethodMask template parameter at all.

pygccxml isn't the problem because , where cvt is an instance of pyplusplus.decl_wrappers.class_wrapper.class_t representing Container::value_type, cvt.less_than_comparable == False.

Discussion

  • The workaround is to manually exclude the "sort" method from the implementation.

    Where c is an instance of pyplusplus.decl_wrappers.typedef_wrapper.typedef_t representing Container, insert the following line into your code generation script:
    pygccxml.declarations.remove_declarated(c).indexing_suite.disable_method('sort')

    I don't know why "indexing_suite" is not an attribute of the pyplusplus.decl_wrappers.typedef_wrapper.typedef_t class.

    I found this workaround in the following post: http://boost.2283326.n4.nabble.com/Py-and-a-std-vector-of-shared-ptrs-td2700689.html