diff --git a/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp b/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp index 601e5cd1ab1..85d8e14bced 100644 --- a/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp +++ b/src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp @@ -133,7 +133,8 @@ bool EDPStatic::initEDP( } // Check there is a Participant's property changing the exchange format. - for (auto& property : mp_RTPSParticipant->get_attributes().properties.properties()) + auto& properties = mp_RTPSParticipant->get_attributes().properties.properties(); + for (auto& property : properties) { if (0 == property.name().compare(exchange_format_property_name)) { diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index 4727494c5b0..adb9d6fbb97 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -3161,7 +3161,7 @@ dds::utils::TypePropagation RTPSParticipantImpl::type_propagation() const return dds::utils::to_type_propagation(m_att.properties); } -RTPSParticipantAttributes RTPSParticipantImpl::get_attributes() const +const RTPSParticipantAttributes& RTPSParticipantImpl::get_attributes() const { return m_att; } diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.h b/src/cpp/rtps/participant/RTPSParticipantImpl.h index d033708604a..a8a6e4f00db 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.h +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.h @@ -795,7 +795,7 @@ class RTPSParticipantImpl public: - RTPSParticipantAttributes get_attributes() const; + const RTPSParticipantAttributes& get_attributes() const; /** * Create a Writer in this RTPSParticipant.