Skip to content

Commit 27e7add

Browse files
committed
core: add registration static method to EigenFromPy
1 parent 6aedd37 commit 27e7add

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

include/eigenpy/details.hpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,15 @@ namespace eigenpy
410410

411411
memory->convertible = storage;
412412
}
413+
414+
static void registration()
415+
{
416+
bp::converter::registry::push_back
417+
(reinterpret_cast<void *(*)(_object *)>(&EigenFromPy::convertible),
418+
&EigenFromPy::construct,bp::type_id<MatType>());
419+
}
420+
};
421+
413422
};
414423

415424
#define numpy_import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); } }
@@ -425,10 +434,7 @@ namespace eigenpy
425434
{
426435
static void registration()
427436
{
428-
bp::converter::registry::push_back
429-
(reinterpret_cast<void *(*)(_object *)>(&EigenFromPy<MatType>::convertible),
430-
&EigenFromPy<MatType>::construct,bp::type_id<MatType>());
431-
437+
EigenFromPy<MatType>::registration();
432438
// Add also conversion to Eigen::MatrixBase<MatType>
433439
bp::converter::registry::push_back
434440
(reinterpret_cast<void *(*)(_object *)>(&EigenFromPy<MatType>::convertible),
@@ -450,7 +456,6 @@ namespace eigenpy
450456
};
451457
#endif
452458

453-
454459
template<typename MatType>
455460
void enableEigenPySpecific()
456461
{

0 commit comments

Comments
 (0)