There was an error while loading. Please reload this page.
1 parent aac2461 commit ab60c59Copy full SHA for ab60c59
1 file changed
core/include/gz/msgs/detail/dynamic_message_cast.hh
@@ -30,7 +30,12 @@ template<typename MsgT>
30
std::unique_ptr<MsgT>
31
dynamic_message_cast(std::unique_ptr<google::protobuf::Message> &&_baseMsg)
32
{
33
+#if GOOGLE_PROTOBUF_VERSION >= 5028000
34
+ auto converted = std::unique_ptr<MsgT>{
35
+ google::protobuf::DynamicCastMessage<MsgT>(_baseMsg.get())};
36
+#else
37
auto converted = std::unique_ptr<MsgT>{dynamic_cast<MsgT*>(_baseMsg.get())};
38
+#endif
39
if (converted) {
40
// transfer ownership to a new unique_ptr object by releasing from old one
41
(void) _baseMsg.release();
0 commit comments