Skip to content

Commit 43093d7

Browse files
committed
Reword/remove comments
1 parent 798c008 commit 43093d7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

libcxx/include/__iterator/bounded_iter.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,14 @@ struct __bounded_iter {
106106
_LIBCPP_ASSERT_INTERNAL(
107107
__current <= __end, "__bounded_iter(current, begin, end): current and end are inconsistent");
108108

109-
// However, this order is important to help the compiler reason about bounds checks. For example, `std::vector` sets
110-
// `__end_ptr` to the capacity, not the true container end. To translate container-end fenceposts into hardening-end
111-
// fenceposts, we must know that container-end <= hardening-end. `std::__to_address` is needed because `_Iterator`
112-
// may be wrapped type, such that `operator<=` has side effects.
109+
// Add assumptions to help the compiler reason about bounds checks. For example, std::vector sets the end of
110+
// the __bounded_iter's valid range to the capacity of the vector, not vector::end(). To translate container-end
111+
// fenceposts into hardening-end fenceposts, we must know that container-end <= hardening-end.
113112
pointer __begin_ptr = std::__to_address(__begin);
114113
pointer __current_ptr = std::__to_address(__current);
115114
pointer __end_ptr = std::__to_address(__end);
116115
_LIBCPP_ASSUME(__begin_ptr <= __current_ptr);
117116
_LIBCPP_ASSUME(__current_ptr <= __end_ptr);
118-
// Silence warnings when assumptions are disabled.
119117
(void)__begin_ptr;
120118
(void)__current_ptr;
121119
(void)__end_ptr;

0 commit comments

Comments
 (0)