noexcept for <bitset>.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132216 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2011-05-27 20:52:28 +00:00
parent a5e0121b8d
commit 10f25d2739
2 changed files with 159 additions and 150 deletions

View File

@ -38,11 +38,13 @@ class __bit_reference
friend class __bit_const_reference<_C>;
friend class __bit_iterator<_C, false>;
public:
_LIBCPP_INLINE_VISIBILITY operator bool() const {return static_cast<bool>(*__seg_ & __mask_);}
_LIBCPP_INLINE_VISIBILITY bool operator ~() const {return !static_cast<bool>(*this);}
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
{return static_cast<bool>(*__seg_ & __mask_);}
_LIBCPP_INLINE_VISIBILITY bool operator ~() const _NOEXCEPT
{return !static_cast<bool>(*this);}
_LIBCPP_INLINE_VISIBILITY
__bit_reference& operator=(bool __x)
__bit_reference& operator=(bool __x) _NOEXCEPT
{
if (__x)
*__seg_ |= __mask_;
@ -52,20 +54,22 @@ public:
}
_LIBCPP_INLINE_VISIBILITY
__bit_reference& operator=(const __bit_reference& __x) {return operator=(static_cast<bool>(__x));}
__bit_reference& operator=(const __bit_reference& __x) _NOEXCEPT
{return operator=(static_cast<bool>(__x));}
_LIBCPP_INLINE_VISIBILITY void flip() {*__seg_ ^= __mask_;}
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const _NOEXCEPT
{return __bit_iterator<_C, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
private:
_LIBCPP_INLINE_VISIBILITY
__bit_reference(__storage_pointer __s, __storage_type __m) : __seg_(__s), __mask_(__m) {}
__bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
: __seg_(__s), __mask_(__m) {}
};
template <class _C, class _D>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__bit_reference<_C> __x, __bit_reference<_D> __y)
swap(__bit_reference<_C> __x, __bit_reference<_D> __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
@ -75,7 +79,7 @@ swap(__bit_reference<_C> __x, __bit_reference<_D> __y)
template <class _C>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__bit_reference<_C> __x, bool& __y)
swap(__bit_reference<_C> __x, bool& __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
@ -85,7 +89,7 @@ swap(__bit_reference<_C> __x, bool& __y)
template <class _C>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(bool& __x, __bit_reference<_C> __y)
swap(bool& __x, __bit_reference<_C> __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
@ -109,16 +113,18 @@ class __bit_const_reference
friend class __bit_iterator<_C, true>;
public:
_LIBCPP_INLINE_VISIBILITY
__bit_const_reference(const __bit_reference<_C>& __x)
__bit_const_reference(const __bit_reference<_C>& __x) _NOEXCEPT
: __seg_(__x.__seg_), __mask_(__x.__mask_) {}
_LIBCPP_INLINE_VISIBILITY operator bool() const {return static_cast<bool>(*__seg_ & __mask_);}
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
{return static_cast<bool>(*__seg_ & __mask_);}
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const _NOEXCEPT
{return __bit_iterator<_C, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
private:
_LIBCPP_INLINE_VISIBILITY
__bit_const_reference(__storage_pointer __s, __storage_type __m) : __seg_(__s), __mask_(__m) {}
__bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
: __seg_(__s), __mask_(__m) {}
__bit_const_reference& operator=(const __bit_const_reference& __x);
};
@ -1057,12 +1063,14 @@ private:
unsigned __ctz_;
public:
_LIBCPP_INLINE_VISIBILITY __bit_iterator() {}
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY __bit_iterator(const __bit_iterator<_C, false>& __it)
_LIBCPP_INLINE_VISIBILITY
__bit_iterator(const __bit_iterator<_C, false>& __it) _NOEXCEPT
: __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return reference(__seg_, __storage_type(1) << __ctz_);}
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
{return reference(__seg_, __storage_type(1) << __ctz_);}
_LIBCPP_INLINE_VISIBILITY __bit_iterator& operator++()
{
@ -1162,7 +1170,8 @@ public:
private:
_LIBCPP_INLINE_VISIBILITY
__bit_iterator(__storage_pointer __s, unsigned __ctz) : __seg_(__s), __ctz_(__ctz) {}
__bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
: __seg_(__s), __ctz_(__ctz) {}
#if defined(__clang__)
friend typename _C::__self;

View File

@ -27,19 +27,19 @@ public:
class reference
{
friend class bitset;
reference();
reference() noexcept;
public:
~reference();
reference& operator=(bool x); // for b[i] = x;
reference& operator=(const reference&); // for b[i] = b[j];
bool operator~() const; // flips the bit
operator bool() const; // for x = b[i];
reference& flip(); // for b[i].flip();
~reference() noexcept;
reference& operator=(bool x) noexcept; // for b[i] = x;
reference& operator=(const reference&) noexcept; // for b[i] = b[j];
bool operator~() const noexcept; // flips the bit
operator bool() const noexcept; // for x = b[i];
reference& flip() noexcept; // for b[i].flip();
};
// 23.3.5.1 constructors:
constexpr bitset();
constexpr bitset(unsigned long long val);
constexpr bitset() noexcept;
constexpr bitset(unsigned long long val) noexcept;
template <class charT>
explicit bitset(const charT* str,
typename basic_string<charT>::size_type n = basic_string<charT>::npos,
@ -52,17 +52,17 @@ public:
charT zero = charT('0'), charT one = charT('1'));
// 23.3.5.2 bitset operations:
bitset& operator&=(const bitset& rhs);
bitset& operator|=(const bitset& rhs);
bitset& operator^=(const bitset& rhs);
bitset& operator<<=(size_t pos);
bitset& operator>>=(size_t pos);
bitset& set();
bitset& operator&=(const bitset& rhs) noexcept;
bitset& operator|=(const bitset& rhs) noexcept;
bitset& operator^=(const bitset& rhs) noexcept;
bitset& operator<<=(size_t pos) noexcept;
bitset& operator>>=(size_t pos) noexcept;
bitset& set() noexcept;
bitset& set(size_t pos, bool val = true);
bitset& reset();
bitset& reset() noexcept;
bitset& reset(size_t pos);
bitset operator~() const;
bitset& flip();
bitset operator~() const noexcept;
bitset& flip() noexcept;
bitset& flip(size_t pos);
// element access:
@ -77,27 +77,27 @@ public:
template <class charT>
basic_string<charT, char_traits<charT>, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const;
basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const;
size_t count() const;
constexpr size_t size() const;
bool operator==(const bitset& rhs) const;
bool operator!=(const bitset& rhs) const;
size_t count() const noexcept;
constexpr size_t size() const noexcept;
bool operator==(const bitset& rhs) const noexcept;
bool operator!=(const bitset& rhs) const noexcept;
bool test(size_t pos) const;
bool all() const;
bool any() const;
bool none() const;
bitset operator<<(size_t pos) const;
bitset operator>>(size_t pos) const;
bool all() const noexcept;
bool any() const noexcept;
bool none() const noexcept;
bitset operator<<(size_t pos) const noexcept;
bitset operator>>(size_t pos) const noexcept;
};
// 23.3.5.3 bitset operators:
template <size_t N>
bitset<N> operator&(const bitset<N>&, const bitset<N>&);
bitset<N> operator&(const bitset<N>&, const bitset<N>&) noexcept;
template <size_t N>
bitset<N> operator|(const bitset<N>&, const bitset<N>&);
bitset<N> operator|(const bitset<N>&, const bitset<N>&) noexcept;
template <size_t N>
bitset<N> operator^(const bitset<N>&, const bitset<N>&);
bitset<N> operator^(const bitset<N>&, const bitset<N>&) noexcept;
template <class charT, class traits, size_t N>
basic_istream<charT, traits>&
@ -155,34 +155,34 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
__bitset();
explicit __bitset(unsigned long long __v);
__bitset() _NOEXCEPT;
explicit __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos)
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
{return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
{return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
void operator&=(const __bitset& __v);
void operator|=(const __bitset& __v);
void operator^=(const __bitset& __v);
void operator&=(const __bitset& __v) _NOEXCEPT;
void operator|=(const __bitset& __v) _NOEXCEPT;
void operator^=(const __bitset& __v) _NOEXCEPT;
void flip();
void flip() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const
{return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());}
_LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const
{return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());}
bool all() const;
bool any() const;
size_t __hash_code() const;
bool all() const _NOEXCEPT;
bool any() const _NOEXCEPT;
size_t __hash_code() const _NOEXCEPT;
private:
void __init(unsigned long long __v, false_type);
void __init(unsigned long long __v, true_type);
void __init(unsigned long long __v, false_type) _NOEXCEPT;
void __init(unsigned long long __v, true_type) _NOEXCEPT;
unsigned long to_ulong(false_type) const;
unsigned long to_ulong(true_type) const;
unsigned long long to_ullong(false_type) const;
@ -193,7 +193,7 @@ private:
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
__bitset<_N_words, _Size>::__bitset()
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
{
_STD::fill_n(__first_, _N_words, __storage_type(0));
}
@ -221,7 +221,7 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type)
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
__bitset<_N_words, _Size>::__bitset(unsigned long long __v)
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
{
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
}
@ -229,7 +229,7 @@ __bitset<_N_words, _Size>::__bitset(unsigned long long __v)
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<_N_words, _Size>::operator&=(const __bitset& __v)
__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
{
for (size_type __i = 0; __i < _N_words; ++__i)
__first_[__i] &= __v.__first_[__i];
@ -238,7 +238,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v)
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<_N_words, _Size>::operator|=(const __bitset& __v)
__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
{
for (size_type __i = 0; __i < _N_words; ++__i)
__first_[__i] |= __v.__first_[__i];
@ -247,7 +247,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v)
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<_N_words, _Size>::operator^=(const __bitset& __v)
__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
{
for (size_type __i = 0; __i < _N_words; ++__i)
__first_[__i] ^= __v.__first_[__i];
@ -255,7 +255,7 @@ __bitset<_N_words, _Size>::operator^=(const __bitset& __v)
template <size_t _N_words, size_t _Size>
void
__bitset<_N_words, _Size>::flip()
__bitset<_N_words, _Size>::flip() _NOEXCEPT
{
// do middle whole words
size_type __n = _Size;
@ -338,7 +338,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const
template <size_t _N_words, size_t _Size>
bool
__bitset<_N_words, _Size>::all() const
__bitset<_N_words, _Size>::all() const _NOEXCEPT
{
// do middle whole words
size_type __n = _Size;
@ -358,7 +358,7 @@ __bitset<_N_words, _Size>::all() const
template <size_t _N_words, size_t _Size>
bool
__bitset<_N_words, _Size>::any() const
__bitset<_N_words, _Size>::any() const _NOEXCEPT
{
// do middle whole words
size_type __n = _Size;
@ -379,7 +379,7 @@ __bitset<_N_words, _Size>::any() const
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
size_t
__bitset<_N_words, _Size>::__hash_code() const
__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
{
size_t __h = 0;
for (size_type __i = 0; __i < _N_words; ++__i)
@ -413,43 +413,43 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
__bitset();
explicit __bitset(unsigned long long __v);
__bitset() _NOEXCEPT;
explicit __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos)
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
{return reference(&__first_, __storage_type(1) << __pos);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
{return const_reference(&__first_, __storage_type(1) << __pos);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
void operator&=(const __bitset& __v);
void operator|=(const __bitset& __v);
void operator^=(const __bitset& __v);
void operator&=(const __bitset& __v) _NOEXCEPT;
void operator|=(const __bitset& __v) _NOEXCEPT;
void operator^=(const __bitset& __v) _NOEXCEPT;
void flip();
void flip() _NOEXCEPT;
unsigned long to_ulong() const;
unsigned long long to_ullong() const;
bool all() const;
bool any() const;
bool all() const _NOEXCEPT;
bool any() const _NOEXCEPT;
size_t __hash_code() const;
size_t __hash_code() const _NOEXCEPT;
};
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
__bitset<1, _Size>::__bitset()
__bitset<1, _Size>::__bitset() _NOEXCEPT
: __first_(0)
{
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
__bitset<1, _Size>::__bitset(unsigned long long __v)
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
: __first_(static_cast<__storage_type>(__v))
{
}
@ -457,7 +457,7 @@ __bitset<1, _Size>::__bitset(unsigned long long __v)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<1, _Size>::operator&=(const __bitset& __v)
__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
{
__first_ &= __v.__first_;
}
@ -465,7 +465,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<1, _Size>::operator|=(const __bitset& __v)
__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
{
__first_ |= __v.__first_;
}
@ -473,7 +473,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<1, _Size>::operator^=(const __bitset& __v)
__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
{
__first_ ^= __v.__first_;
}
@ -481,7 +481,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<1, _Size>::flip()
__bitset<1, _Size>::flip() _NOEXCEPT
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
__first_ = ~__first_;
@ -507,7 +507,7 @@ __bitset<1, _Size>::to_ullong() const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bool
__bitset<1, _Size>::all() const
__bitset<1, _Size>::all() const _NOEXCEPT
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
return !(~__first_ & __m);
@ -516,7 +516,7 @@ __bitset<1, _Size>::all() const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bool
__bitset<1, _Size>::any() const
__bitset<1, _Size>::any() const _NOEXCEPT
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
return __first_ & __m;
@ -525,7 +525,7 @@ __bitset<1, _Size>::any() const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
size_t
__bitset<1, _Size>::__hash_code() const
__bitset<1, _Size>::__hash_code() const _NOEXCEPT
{
return __first_;
}
@ -554,40 +554,40 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
__bitset();
explicit __bitset(unsigned long long);
__bitset() _NOEXCEPT;
explicit __bitset(unsigned long long) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t)
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
{return reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _NOEXCEPT
{return const_reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) {}
_LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) {}
_LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) {}
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY void flip() {}
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const {return 0;}
_LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const {return 0;}
_LIBCPP_INLINE_VISIBILITY bool all() const {return true;}
_LIBCPP_INLINE_VISIBILITY bool any() const {return false;}
_LIBCPP_INLINE_VISIBILITY bool all() const _NOEXCEPT {return true;}
_LIBCPP_INLINE_VISIBILITY bool any() const _NOEXCEPT {return false;}
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const {return 0;}
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
};
inline _LIBCPP_INLINE_VISIBILITY
__bitset<0, 0>::__bitset()
__bitset<0, 0>::__bitset() _NOEXCEPT
{
}
inline _LIBCPP_INLINE_VISIBILITY
__bitset<0, 0>::__bitset(unsigned long long)
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
{
}
@ -606,8 +606,8 @@ public:
typedef typename base::const_reference const_reference;
// 23.3.5.1 constructors:
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() {}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) : base(__v) {}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() _NOEXCEPT {}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
template<class _CharT>
explicit bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
@ -620,17 +620,17 @@ public:
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
// 23.3.5.2 bitset operations:
bitset& operator&=(const bitset& __rhs);
bitset& operator|=(const bitset& __rhs);
bitset& operator^=(const bitset& __rhs);
bitset& operator<<=(size_t __pos);
bitset& operator>>=(size_t __pos);
bitset& set();
bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
bitset& operator<<=(size_t __pos) _NOEXCEPT;
bitset& operator>>=(size_t __pos) _NOEXCEPT;
bitset& set() _NOEXCEPT;
bitset& set(size_t __pos, bool __val = true);
bitset& reset();
bitset& reset() _NOEXCEPT;
bitset& reset(size_t __pos);
bitset operator~() const;
bitset& flip();
bitset operator~() const _NOEXCEPT;
bitset& flip() _NOEXCEPT;
bitset& flip(size_t __pos);
// element access:
@ -649,21 +649,21 @@ public:
_CharT __one = _CharT('1')) const;
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
char __one = '1') const;
size_t count() const;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const {return _Size;}
bool operator==(const bitset& __rhs) const;
bool operator!=(const bitset& __rhs) const;
size_t count() const _NOEXCEPT;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const _NOEXCEPT {return _Size;}
bool operator==(const bitset& __rhs) const _NOEXCEPT;
bool operator!=(const bitset& __rhs) const _NOEXCEPT;
bool test(size_t __pos) const;
bool all() const;
bool any() const;
_LIBCPP_INLINE_VISIBILITY bool none() const {return !any();}
bitset operator<<(size_t __pos) const;
bitset operator>>(size_t __pos) const;
bool all() const _NOEXCEPT;
bool any() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();}
bitset operator<<(size_t __pos) const _NOEXCEPT;
bitset operator>>(size_t __pos) const _NOEXCEPT;
private:
_LIBCPP_INLINE_VISIBILITY
size_t __hash_code() const {return base::__hash_code();}
size_t __hash_code() const _NOEXCEPT {return base::__hash_code();}
friend struct hash<bitset>;
};
@ -732,7 +732,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::operator&=(const bitset& __rhs)
bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
{
base::operator&=(__rhs);
return *this;
@ -741,7 +741,7 @@ bitset<_Size>::operator&=(const bitset& __rhs)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::operator|=(const bitset& __rhs)
bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
{
base::operator|=(__rhs);
return *this;
@ -750,7 +750,7 @@ bitset<_Size>::operator|=(const bitset& __rhs)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::operator^=(const bitset& __rhs)
bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
{
base::operator^=(__rhs);
return *this;
@ -758,7 +758,7 @@ bitset<_Size>::operator^=(const bitset& __rhs)
template <size_t _Size>
bitset<_Size>&
bitset<_Size>::operator<<=(size_t __pos)
bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT
{
__pos = _STD::min(__pos, _Size);
_STD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
@ -768,7 +768,7 @@ bitset<_Size>::operator<<=(size_t __pos)
template <size_t _Size>
bitset<_Size>&
bitset<_Size>::operator>>=(size_t __pos)
bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
{
__pos = _STD::min(__pos, _Size);
_STD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
@ -779,7 +779,7 @@ bitset<_Size>::operator>>=(size_t __pos)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::set()
bitset<_Size>::set() _NOEXCEPT
{
_STD::fill_n(base::__make_iter(0), _Size, true);
return *this;
@ -802,7 +802,7 @@ bitset<_Size>::set(size_t __pos, bool __val)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::reset()
bitset<_Size>::reset() _NOEXCEPT
{
_STD::fill_n(base::__make_iter(0), _Size, false);
return *this;
@ -825,7 +825,7 @@ bitset<_Size>::reset(size_t __pos)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>
bitset<_Size>::operator~() const
bitset<_Size>::operator~() const _NOEXCEPT
{
bitset __x(*this);
__x.flip();
@ -835,7 +835,7 @@ bitset<_Size>::operator~() const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::flip()
bitset<_Size>::flip() _NOEXCEPT
{
base::flip();
return *this;
@ -915,7 +915,7 @@ bitset<_Size>::to_string(char __zero, char __one) const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
size_t
bitset<_Size>::count() const
bitset<_Size>::count() const _NOEXCEPT
{
return static_cast<size_t>(_STD::count(base::__make_iter(0), base::__make_iter(_Size), true));
}
@ -923,7 +923,7 @@ bitset<_Size>::count() const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bool
bitset<_Size>::operator==(const bitset& __rhs) const
bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
{
return _STD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
}
@ -931,7 +931,7 @@ bitset<_Size>::operator==(const bitset& __rhs) const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bool
bitset<_Size>::operator!=(const bitset& __rhs) const
bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
{
return !(*this == __rhs);
}
@ -952,7 +952,7 @@ bitset<_Size>::test(size_t __pos) const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bool
bitset<_Size>::all() const
bitset<_Size>::all() const _NOEXCEPT
{
return base::all();
}
@ -960,7 +960,7 @@ bitset<_Size>::all() const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bool
bitset<_Size>::any() const
bitset<_Size>::any() const _NOEXCEPT
{
return base::any();
}
@ -968,7 +968,7 @@ bitset<_Size>::any() const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>
bitset<_Size>::operator<<(size_t __pos) const
bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
{
bitset __r = *this;
__r <<= __pos;
@ -978,7 +978,7 @@ bitset<_Size>::operator<<(size_t __pos) const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>
bitset<_Size>::operator>>(size_t __pos) const
bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
{
bitset __r = *this;
__r >>= __pos;
@ -988,7 +988,7 @@ bitset<_Size>::operator>>(size_t __pos) const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>
operator&(const bitset<_Size>& __x, const bitset<_Size>& __y)
operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
{
bitset<_Size> __r = __x;
__r &= __y;
@ -998,7 +998,7 @@ operator&(const bitset<_Size>& __x, const bitset<_Size>& __y)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>
operator|(const bitset<_Size>& __x, const bitset<_Size>& __y)
operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
{
bitset<_Size> __r = __x;
__r |= __y;
@ -1008,7 +1008,7 @@ operator|(const bitset<_Size>& __x, const bitset<_Size>& __y)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>
operator^(const bitset<_Size>& __x, const bitset<_Size>& __y)
operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
{
bitset<_Size> __r = __x;
__r ^= __y;
@ -1020,7 +1020,7 @@ struct _LIBCPP_VISIBLE hash<bitset<_Size> >
: public unary_function<bitset<_Size>, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const bitset<_Size>& __bs) const
size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT
{return __bs.__hash_code();}
};