@@ -136,6 +136,8 @@ template <size_t N> struct hash<std::bitset<N>>;
136136# include < __assert>
137137# include < __bit_reference>
138138# include < __config>
139+ # include < __cstddef/ptrdiff_t.h>
140+ # include < __cstddef/size_t.h>
139141# include < __functional/hash.h>
140142# include < __functional/unary_function.h>
141143# include < __type_traits/is_char_like_type.h>
@@ -167,12 +169,18 @@ struct __has_storage_type<__bitset<_N_words, _Size> > {
167169 static const bool value = true ;
168170};
169171
172+ template <size_t _N_words, size_t _Size>
173+ struct __size_difference_type_traits <std::__bitset<_N_words, _Size> > {
174+ using difference_type = typename std::__bitset<_N_words, _Size>::__difference_type;
175+ using size_type = typename std::__bitset<_N_words, _Size>::__size_type;
176+ };
177+
170178template <size_t _N_words, size_t _Size>
171179class __bitset {
172180public:
173- typedef ptrdiff_t difference_type ;
174- typedef size_t size_type ;
175- typedef size_type __storage_type;
181+ typedef ptrdiff_t __difference_type ;
182+ typedef size_t __size_type ;
183+ typedef size_t __storage_type;
176184
177185protected:
178186 typedef __bitset __self;
@@ -301,28 +309,28 @@ inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long
301309template <size_t _N_words, size_t _Size>
302310inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
303311__bitset<_N_words, _Size>::operator &=(const __bitset& __v) _NOEXCEPT {
304- for (size_type __i = 0 ; __i < _N_words; ++__i)
312+ for (size_t __i = 0 ; __i < _N_words; ++__i)
305313 __first_[__i] &= __v.__first_ [__i];
306314}
307315
308316template <size_t _N_words, size_t _Size>
309317inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
310318__bitset<_N_words, _Size>::operator |=(const __bitset& __v) _NOEXCEPT {
311- for (size_type __i = 0 ; __i < _N_words; ++__i)
319+ for (size_t __i = 0 ; __i < _N_words; ++__i)
312320 __first_[__i] |= __v.__first_ [__i];
313321}
314322
315323template <size_t _N_words, size_t _Size>
316324inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
317325__bitset<_N_words, _Size>::operator ^=(const __bitset& __v) _NOEXCEPT {
318- for (size_type __i = 0 ; __i < _N_words; ++__i)
326+ for (size_t __i = 0 ; __i < _N_words; ++__i)
319327 __first_[__i] ^= __v.__first_ [__i];
320328}
321329
322330template <size_t _N_words, size_t _Size>
323331_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void __bitset<_N_words, _Size>::flip() _NOEXCEPT {
324332 // do middle whole words
325- size_type __n = _Size;
333+ size_t __n = _Size;
326334 __storage_pointer __p = __first_;
327335 for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
328336 *__p = ~*__p;
@@ -390,7 +398,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const {
390398template <size_t _N_words, size_t _Size>
391399_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<_N_words, _Size>::all() const _NOEXCEPT {
392400 // do middle whole words
393- size_type __n = _Size;
401+ size_t __n = _Size;
394402 __const_storage_pointer __p = __first_;
395403 for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
396404 if (~*__p)
@@ -407,7 +415,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<_N_words, _Siz
407415template <size_t _N_words, size_t _Size>
408416_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<_N_words, _Size>::any() const _NOEXCEPT {
409417 // do middle whole words
410- size_type __n = _Size;
418+ size_t __n = _Size;
411419 __const_storage_pointer __p = __first_;
412420 for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word)
413421 if (*__p)
@@ -424,17 +432,17 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool __bitset<_N_words, _Siz
424432template <size_t _N_words, size_t _Size>
425433inline size_t __bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT {
426434 size_t __h = 0 ;
427- for (size_type __i = 0 ; __i < _N_words; ++__i)
435+ for (size_t __i = 0 ; __i < _N_words; ++__i)
428436 __h ^= __first_[__i];
429437 return __h;
430438}
431439
432440template <size_t _Size>
433441class __bitset <1 , _Size> {
434442public:
435- typedef ptrdiff_t difference_type ;
436- typedef size_t size_type ;
437- typedef size_type __storage_type;
443+ typedef ptrdiff_t __difference_type ;
444+ typedef size_t __size_type ;
445+ typedef size_t __storage_type;
438446
439447protected:
440448 typedef __bitset __self;
@@ -549,9 +557,9 @@ inline size_t __bitset<1, _Size>::__hash_code() const _NOEXCEPT {
549557template <>
550558class __bitset <0 , 0 > {
551559public:
552- typedef ptrdiff_t difference_type ;
553- typedef size_t size_type ;
554- typedef size_type __storage_type;
560+ typedef ptrdiff_t __difference_type ;
561+ typedef size_t __size_type ;
562+ typedef size_t __storage_type;
555563
556564protected:
557565 typedef __bitset __self;
0 commit comments