Skip to content

Commit c8a5027

Browse files
committed
Remove unnecessary if condition and comment
1 parent acc1a87 commit c8a5027

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

libcxx/include/__vector/vector_bool.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ vector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x) {
561561
capacity() >= size() + __n, "vector<bool>::__construct_at_end called with insufficient capacity");
562562
std::fill_n(end(), __n, __x);
563563
this->__size_ += __n;
564-
if (end().__ctz_ != 0) // has uninitialized trailing bits in the last word
564+
if (end().__ctz_ != 0) // Ensure uninitialized leading bits in the last word are set to zero
565565
std::fill_n(end(), __bits_per_word - end().__ctz_, 0);
566566
}
567567

@@ -573,7 +573,7 @@ vector<bool, _Allocator>::__construct_at_end(_InputIterator __first, _Sentinel _
573573
capacity() >= size() + __n, "vector<bool>::__construct_at_end called with insufficient capacity");
574574
std::__copy(std::move(__first), std::move(__last), end());
575575
this->__size_ += __n;
576-
if (end().__ctz_ != 0) // has uninitialized trailing bits in the last word
576+
if (end().__ctz_ != 0) // Ensure uninitialized leading bits in the last word are set to zero
577577
std::fill_n(end(), __bits_per_word - end().__ctz_, 0);
578578
}
579579

@@ -848,9 +848,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::reserve(size_type _
848848
this->__throw_length_error();
849849
vector __v(this->get_allocator());
850850
__v.__vallocate(__n);
851-
// Ensure that the call to __construct_at_end(first, last, n) meets the precondition of n > 0
852-
if (this->size() > 0)
853-
__v.__construct_at_end(this->begin(), this->end(), this->size());
851+
__v.__construct_at_end(this->begin(), this->end(), this->size());
854852
swap(__v);
855853
}
856854
}

0 commit comments

Comments
 (0)