Skip to content

Commit b391e80

Browse files
authored
[libc++] Remove redundant assignments in bitset string-like constructors (#121424)
The following three string-like constructors for `std::bitset` - `bitset(const CharT* str, std::size_t n, CharT zero, CharT one)`; - `bitset(const std::basic_string<CharT, Traits, Alloc>& str, typename std::basic_string<CharT, Traits, Alloc>::size_type pos, CharT zero, CharT one)`; - `bitset(std::basic_string_view<CharT, Traits> str, std::size_t pos, std::size_t n, CharT zero, CharT one)` already initialize the underlying storage array to all zeroes via default-constructor of the base class `__bitset`. Therefore, re-assigning the storage array to zeroes via `std::fill_n` in the string-like constructors is truly redundant.
1 parent 467e5a1 commit b391e80

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

libcxx/include/bitset

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,6 @@ private:
733733
_CharT __c = __str[__mp - 1 - __i];
734734
(*this)[__i] = _Traits::eq(__c, __one);
735735
}
736-
std::fill(__base::__make_iter(__i), __base::__make_iter(_Size), false);
737736
}
738737

739738
_LIBCPP_HIDE_FROM_ABI size_t __hash_code() const _NOEXCEPT { return __base::__hash_code(); }

0 commit comments

Comments
 (0)