From 6552b9ac7a0e21a00797f4930727d7a9d43bb282 Mon Sep 17 00:00:00 2001
From: Justin Carpentier <justin.carpentier@inria.fr>
Date: Tue, 3 Sep 2024 17:21:10 +0200
Subject: [PATCH] core: avoid duplicate registration

---
 src/type_info.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/type_info.cpp b/src/type_info.cpp
index 98e1e44f..482370ce 100644
--- a/src/type_info.cpp
+++ b/src/type_info.cpp
@@ -8,10 +8,16 @@
 #include <boost/python.hpp>
 #include <boost/type_index.hpp>
 
+#include "eigenpy/registration.hpp"
+
 namespace bp = boost::python;
 
+namespace eigenpy {
+
 void exposeStdTypeIndex() {
   typedef std::type_index Self;
+  if (register_symbolic_link_to_registered_type<Self>()) return;
+
   bp::class_<Self>(
       "std_type_index",
       "The class type_index holds implementation-specific information about a "
@@ -42,6 +48,8 @@ void exposeStdTypeIndex() {
 
 void exposeBoostTypeIndex() {
   typedef boost::typeindex::type_index Self;
+  if (register_symbolic_link_to_registered_type<Self>()) return;
+
   bp::class_<Self>(
       "boost_type_index",
       "The class type_index holds implementation-specific information about a "
@@ -66,7 +74,6 @@ void exposeBoostTypeIndex() {
            "Human readible name.");
 }
 
-namespace eigenpy {
 void exposeTypeInfo() {
   exposeStdTypeIndex();
   exposeBoostTypeIndex();
-- 
GitLab