diff options
author | Abseil Team <absl-team@google.com> | 2022-09-08 12:21:40 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-09-08 12:22:28 -0700 |
commit | 69199fcebe806a49a21992575b5227ee432f6917 (patch) | |
tree | 9013b1e4fc06bd7fa9a7d69ecdb9739eb184cfb8 /absl/container/inlined_vector.h | |
parent | 518984e432e0597fd4e66a9c52148e8dec2bb46a (diff) |
Fix "unsafe narrowing" warnings in absl, 9/n.
Addresses failures with the following, in some files:
-Wshorten-64-to-32
-Wimplicit-int-conversion
-Wsign-compare
-Wsign-conversion
-Wtautological-unsigned-zero-compare
(This specific CL focuses on miscellaneous non-test source files.)
Bug: chromium:1292951
PiperOrigin-RevId: 473054605
Change-Id: Ifd7b24966613ca915511a3a607095508068200b8
Diffstat (limited to 'absl/container/inlined_vector.h')
-rw-r--r-- | absl/container/inlined_vector.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/absl/container/inlined_vector.h b/absl/container/inlined_vector.h index 08a47709..60f12460 100644 --- a/absl/container/inlined_vector.h +++ b/absl/container/inlined_vector.h @@ -626,9 +626,9 @@ class InlinedVector { ABSL_HARDENING_ASSERT(pos <= end()); if (ABSL_PREDICT_TRUE(first != last)) { - return storage_.Insert(pos, - IteratorValueAdapter<A, ForwardIterator>(first), - std::distance(first, last)); + return storage_.Insert( + pos, IteratorValueAdapter<A, ForwardIterator>(first), + static_cast<size_type>(std::distance(first, last))); } else { return const_cast<iterator>(pos); } @@ -645,7 +645,7 @@ class InlinedVector { ABSL_HARDENING_ASSERT(pos >= begin()); ABSL_HARDENING_ASSERT(pos <= end()); - size_type index = std::distance(cbegin(), pos); + size_type index = static_cast<size_type>(std::distance(cbegin(), pos)); for (size_type i = index; first != last; ++i, static_cast<void>(++first)) { insert(data() + i, *first); } |