File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed
doc/modules/ROOT/examples/custom_rtti Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -54,18 +54,22 @@ struct custom_rtti : boost::openmethod::policies::rtti {
5454 template <typename T>
5555 static auto static_type () {
5656 if constexpr (is_polymorphic<T>) {
57- return reinterpret_cast <type_id>(T::static_type);
57+ return reinterpret_cast <type_id>(
58+ static_cast <std::uintptr_t >(T::static_type));
5859 } else {
59- return reinterpret_cast <type_id>(0 );
60+ return reinterpret_cast <type_id>(
61+ static_cast <std::uintptr_t >(0 ));
6062 }
6163 }
6264
6365 template <typename T>
6466 static auto dynamic_type (const T& obj) {
6567 if constexpr (is_polymorphic<T>) {
66- return reinterpret_cast <type_id>(obj.type );
68+ return reinterpret_cast <type_id>(
69+ static_cast <std::uintptr_t >(obj.type ));
6770 } else {
68- return reinterpret_cast <type_id>(0 );
71+ return reinterpret_cast <type_id>(
72+ static_cast <std::uintptr_t >(0 ));
6973 }
7074 }
7175 };
Original file line number Diff line number Diff line change @@ -50,18 +50,22 @@ struct custom_rtti : boost::openmethod::policies::deferred_static_rtti {
5050 template <typename T>
5151 static auto static_type () {
5252 if constexpr (is_polymorphic<T>) {
53- return reinterpret_cast <type_id>(T::static_type);
53+ return reinterpret_cast <type_id>(
54+ static_cast <std::uintptr_t >(T::static_type));
5455 } else {
55- return reinterpret_cast <type_id>(0 );
56+ return reinterpret_cast <type_id>(
57+ static_cast <std::uintptr_t >(0 ));
5658 }
5759 }
5860
5961 template <typename T>
6062 static auto dynamic_type (const T& obj) {
6163 if constexpr (is_polymorphic<T>) {
62- return reinterpret_cast <type_id>(obj.type );
64+ return reinterpret_cast <type_id>(
65+ static_cast <std::uintptr_t >(obj.type ));
6366 } else {
64- return reinterpret_cast <type_id>(0 );
67+ return reinterpret_cast <type_id>(
68+ static_cast <std::uintptr_t >(0 ));
6569 }
6670 }
6771 };
You can’t perform that action at this time.
0 commit comments