fix new clang-tidy warnings: cppcoreguidelines-pro-bounds-pointer-arithmetic

https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-bounds-pointer-arithmetic.html
This commit is contained in:
BlackMATov
2025-01-17 20:38:52 +07:00
parent c68505ea8f
commit 33a30c6f48
2 changed files with 6 additions and 2 deletions

View File

@@ -911,7 +911,9 @@ namespace meta_hpp::detail
template < typename... Args >
T& emplace_back(Args&&... args) {
META_HPP_ASSERT(end_ < capacity_ && "full vector");
return *std::construct_at(end_++, std::forward<Args>(args)...);
T& result = *std::construct_at(end_, std::forward<Args>(args)...);
++end_; // NOLINT(*-pointer-arithmetic)
return result;
}
[[nodiscard]] std::size_t get_size() const noexcept {

View File

@@ -48,7 +48,9 @@ namespace meta_hpp::detail
template < typename... Args >
T& emplace_back(Args&&... args) {
META_HPP_ASSERT(end_ < capacity_ && "full vector");
return *std::construct_at(end_++, std::forward<Args>(args)...);
T& result = *std::construct_at(end_, std::forward<Args>(args)...);
++end_; // NOLINT(*-pointer-arithmetic)
return result;
}
[[nodiscard]] std::size_t get_size() const noexcept {