11// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
2- // Copyright (c) 2021 - 2022 by Apex.AI Inc. All rights reserved.
2+ // Copyright (c) 2021 - 2023 by Apex.AI Inc. All rights reserved.
33//
44// Licensed under the Apache License, Version 2.0 (the "License");
55// you may not use this file except in compliance with the License.
@@ -53,6 +53,8 @@ inline vector<T, Capacity>::vector(const uint64_t count) noexcept
5353 for (uint64_t i{0U }; i < m_size; ++i)
5454 {
5555 // AXIVION Next Line AutosarC++19_03-A18.5.2 : false positive, it is a placement new
56+ // AXIVION Next Line FaultDetection-IndirectAssignmentOverflow : False positive. Size at
57+ // location guaranteed by T.
5658 new (&at (i)) T ();
5759 }
5860}
@@ -87,6 +89,8 @@ inline vector<T, Capacity>& vector<T, Capacity>::operator=(const vector& rhs) no
8789 // copy using copy assignment
8890 for (; i < minSize; ++i)
8991 {
92+ // AXIVION Next Line AutosarC++19_03-A5.0.1 : Expands to basic variable assignment.
93+ // Evaluation order is inconsequential.
9094 at (i) = rhs.at (i);
9195 }
9296
@@ -116,6 +120,8 @@ inline vector<T, Capacity>& vector<T, Capacity>::operator=(vector&& rhs) noexcep
116120 // move using move assignment
117121 for (; i < minSize; ++i)
118122 {
123+ // AXIVION Next Line AutosarC++19_03-A5.0.1 : Expands to basic variable assignment.
124+ // Evaluation order is inconsequential.
119125 at (i) = std::move (rhs.at (i));
120126 }
121127
@@ -164,6 +170,9 @@ inline bool vector<T, Capacity>::emplace_back(Targs&&... args) noexcept
164170{
165171 if (m_size < Capacity)
166172 {
173+ // AXIVION Next Construct FaultDetection-IndirectAssignmentOverflow : False positive. Size at
174+ // location guaranteed by T
175+ // AXIVION Next Construct AutosarC++19_03-A5.0.1 : Evaluation order is inconsequential.
167176 new (&at (m_size++)) T (std::forward<Targs>(args)...);
168177 return true ;
169178 }
@@ -174,7 +183,7 @@ template <typename T, uint64_t Capacity>
174183template <typename ... Targs>
175184inline bool vector<T, Capacity>::emplace(const uint64_t position, Targs&&... args) noexcept
176185{
177- const auto sizeBeforeEmplace = m_size;
186+ const uint64_t sizeBeforeEmplace = m_size;
178187 if ((m_size >= Capacity) || ((position >= Capacity) || (position > sizeBeforeEmplace)))
179188 {
180189 return false ;
@@ -350,10 +359,13 @@ inline bool vector<T, Capacity>::erase(iterator position) noexcept
350359{
351360 if ((begin () <= position) && (position < end ()))
352361 {
362+ // AXIVION Next Line AutosarC++19_03-M5.0.9 : False positive. Pointer arithmetic occurs here.
353363 uint64_t index{static_cast <uint64_t >(position - begin ())};
354364 size_t n{index};
355365 while ((n + 1U ) < size ())
356366 {
367+ // AXIVION Next Line AutosarC++19_03-A5.0.1 : Expands to basic variable assignment.
368+ // Evaluation order is inconsequential.
357369 at (n) = std::move (at (n + 1U ));
358370 ++n;
359371 }
0 commit comments