Skip to content

Commit 249618f

Browse files
committed
core: use implicitly_convertible
1 parent b20044c commit 249618f

File tree

1 file changed

+2
-29
lines changed

1 file changed

+2
-29
lines changed

include/eigenpy/details.hpp

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -515,33 +515,6 @@ namespace eigenpy
515515
}
516516
};
517517

518-
template<typename MatType>
519-
struct EigenFromPy< Eigen::MatrixBase<MatType> >
520-
{
521-
typedef EigenFromPy<MatType> EigenFromPyDerived;
522-
typedef Eigen::MatrixBase<MatType> Base;
523-
524-
/// \brief Determine if pyObj can be converted into a MatType object
525-
static void* convertible(PyArrayObject* pyObj)
526-
{
527-
return EigenFromPyDerived::convertible(pyObj);
528-
}
529-
530-
/// \brief Allocate memory and copy pyObj in the new storage
531-
static void construct(PyObject* pyObj,
532-
bp::converter::rvalue_from_python_stage1_data* memory)
533-
{
534-
EigenFromPyDerived::construct(pyObj,memory);
535-
}
536-
537-
static void registration()
538-
{
539-
bp::converter::registry::push_back
540-
(reinterpret_cast<void *(*)(_object *)>(&EigenFromPy::convertible),
541-
&EigenFromPy::construct,bp::type_id<Base>());
542-
}
543-
};
544-
545518
template<typename MatType,typename EigenEquivalentType>
546519
void enableEigenPySpecific()
547520
{
@@ -557,7 +530,8 @@ namespace eigenpy
557530

558531
// Add also conversion to Eigen::MatrixBase<MatType>
559532
typedef Eigen::MatrixBase<MatType> MatTypeBase;
560-
EigenFromPy<MatTypeBase>::registration();
533+
bp::implicitly_convertible<MatType,MatTypeBase>();
534+
bp::implicitly_convertible<MatTypeBase,MatType>();
561535
}
562536
};
563537

@@ -585,7 +559,6 @@ namespace eigenpy
585559

586560
bp::to_python_converter<MatType,EigenToPy<MatType> >();
587561
EigenFromPyConverter<MatType>::registration();
588-
589562
}
590563

591564
} // namespace eigenpy

0 commit comments

Comments
 (0)