Skip to content
Snippets Groups Projects
Commit e6e70ed0 authored by Joris Vaillant's avatar Joris Vaillant Committed by Justin Carpentier
Browse files

core: fix StdVectorPythonVisitor::expose API

parent e1d426ea
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,12 @@ class registration_class {
return *this;
}
template <class DerivedVisitor>
self& def(bp::def_visitor<DerivedVisitor> const& visitor) {
static_cast<DerivedVisitor const&>(visitor).visit(*this);
return *this;
}
/// \see boost::python::class_::def(char const* name, F f)
template <class F>
self& def(char const* name, F f) {
......
......@@ -67,7 +67,7 @@ struct build_list<vector_type, true> {
}
};
/// \brief Change the behaviour of indexing (method __getitem__ in Python).
/// \brief Change the behavior of indexing (method __getitem__ in Python).
/// This is suitable for container of Eigen matrix objects if you want to mutate
/// them.
template <typename Container>
......@@ -418,14 +418,17 @@ struct StdVectorPythonVisitor {
expose(class_name, doc_string, EmptyPythonVisitor());
}
template <typename Visitor>
static void expose(const std::string &class_name, const Visitor &visitor) {
template <typename DerivedVisitor>
static void expose(
const std::string &class_name,
const boost::python::def_visitor<DerivedVisitor> &visitor) {
expose(class_name, "", visitor);
}
template <typename Visitor>
static void expose(const std::string &class_name,
const std::string &doc_string, const Visitor &visitor) {
template <typename DerivedVisitor>
static void expose(
const std::string &class_name, const std::string &doc_string,
const boost::python::def_visitor<DerivedVisitor> &visitor) {
// Apply visitor on already registered type or if type is not already
// registered, we define and apply the visitor on it
auto add_std_visitor =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment