Skip to content

Commit

Permalink
Merge pull request #2195 from elBoberido/iox-2082-fix-value-initializ…
Browse files Browse the repository at this point in the history
…ation-for-iox-vector-elements

iox-#2082 Always initialize members in 'iox::vector(count)'
  • Loading branch information
elBoberido authored Feb 18, 2024
2 parents f602986 + 66e741a commit a21603a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions iceoryx_hoofs/container/include/iox/detail/vector.inl
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,10 @@ inline vector<T, Capacity>::vector(const uint64_t count) noexcept
}

m_size = std::min(count, Capacity);
// If the type is a trivial class without member initialization the constructor would not initialize the data
if constexpr (!(std::is_trivial<T>::value && std::is_class<T>::value))
for (uint64_t i{0U}; i < m_size; ++i)
{
for (uint64_t i{0U}; i < m_size; ++i)
{
// AXIVION Next Line AutosarC++19_03-A18.5.2, FaultDetection-IndirectAssignmentOverflow : False positive, it is a placement new. Size guaranteed by T.
new (&at_unchecked(i)) T();
}
// AXIVION Next Line AutosarC++19_03-A18.5.2, FaultDetection-IndirectAssignmentOverflow : False positive, it is a placement new. Size guaranteed by T.
new (&at_unchecked(i)) T();
}
}

Expand Down

0 comments on commit a21603a

Please sign in to comment.