@@ -350,6 +350,21 @@ class TypeInfo
350
350
template <typename T>
351
351
static TypeInfo Create ()
352
352
{
353
+ // store the base class typeid if specialized
354
+ if constexpr (is_shared_ptr<T>::value)
355
+ {
356
+ using Elem = typename T::element_type;
357
+ using Base = typename any_cast_base<Elem>::type;
358
+
359
+ if constexpr (!std::is_same_v<Base, void >)
360
+ {
361
+ static_assert (std::is_polymorphic_v<Base>, " TypeInfo Base trait specialization "
362
+ " must be "
363
+ " polymorphic" );
364
+ return TypeInfo{ typeid (std::shared_ptr<Base>),
365
+ GetAnyFromStringFunctor<std::shared_ptr<Base>>() };
366
+ }
367
+ }
353
368
return TypeInfo{ typeid (T), GetAnyFromStringFunctor<T>() };
354
369
}
355
370
@@ -452,7 +467,8 @@ template <typename T = AnyTypeAllowed>
452
467
}
453
468
else
454
469
{
455
- out = { sname, PortInfo (direction, typeid (T), GetAnyFromStringFunctor<T>()) };
470
+ auto type_info = TypeInfo::Create<T>();
471
+ out = { sname, PortInfo (direction, type_info.type (), type_info.converter ()) };
456
472
}
457
473
if (!description.empty ())
458
474
{
@@ -501,7 +517,6 @@ BidirectionalPort(StringView name, StringView description = {})
501
517
502
518
namespace details
503
519
{
504
-
505
520
template <typename T = AnyTypeAllowed, typename DefaultT = T>
506
521
[[nodiscard]] inline std::pair<std::string, PortInfo>
507
522
PortWithDefault (PortDirection direction, StringView name, const DefaultT& default_value,
0 commit comments