// Debugging bitset implementation -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
reference();
reference(const _Base_ref& __base,
- bitset* __seq __attribute__((__unused__)))
+ bitset* __seq __attribute__((__unused__))) _GLIBCXX_NOEXCEPT
: _Base_ref(__base)
, _Safe_iterator_base(__seq, false)
{ }
public:
- reference(const reference& __x)
+ reference(const reference& __x) _GLIBCXX_NOEXCEPT
: _Base_ref(__x)
, _Safe_iterator_base(__x, false)
{ }
reference&
- operator=(bool __x)
+ operator=(bool __x) _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_write)
}
reference&
- operator=(const reference& __x)
+ operator=(const reference& __x) _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __x._M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_read)
}
bool
- operator~() const
+ operator~() const _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_read)
return ~(*static_cast<const _Base_ref*>(this));
}
- operator bool() const
+ operator bool() const _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_read)
}
reference&
- flip()
+ flip() _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_flip)
#endif
// 23.3.5.1 constructors:
- _GLIBCXX_CONSTEXPR bitset() : _Base() { }
+ _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT
+ : _Base() { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- constexpr bitset(unsigned long long __val)
+ constexpr bitset(unsigned long long __val) noexcept
#else
bitset(unsigned long __val)
#endif
// 23.3.5.2 bitset operations:
bitset<_Nb>&
- operator&=(const bitset<_Nb>& __rhs)
+ operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{
_M_base() &= __rhs;
return *this;
}
bitset<_Nb>&
- operator|=(const bitset<_Nb>& __rhs)
+ operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{
_M_base() |= __rhs;
return *this;
}
bitset<_Nb>&
- operator^=(const bitset<_Nb>& __rhs)
+ operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{
_M_base() ^= __rhs;
return *this;
}
bitset<_Nb>&
- operator<<=(size_t __pos)
+ operator<<=(size_t __pos) _GLIBCXX_NOEXCEPT
{
_M_base() <<= __pos;
return *this;
}
bitset<_Nb>&
- operator>>=(size_t __pos)
+ operator>>=(size_t __pos) _GLIBCXX_NOEXCEPT
{
_M_base() >>= __pos;
return *this;
}
bitset<_Nb>&
- set()
+ set() _GLIBCXX_NOEXCEPT
{
_Base::set();
return *this;
}
bitset<_Nb>&
- reset()
+ reset() _GLIBCXX_NOEXCEPT
{
_Base::reset();
return *this;
return *this;
}
- bitset<_Nb> operator~() const { return bitset(~_M_base()); }
+ bitset<_Nb>
+ operator~() const _GLIBCXX_NOEXCEPT
+ { return bitset(~_M_base()); }
bitset<_Nb>&
- flip()
+ flip() _GLIBCXX_NOEXCEPT
{
_Base::flip();
return *this;
using _Base::size;
bool
- operator==(const bitset<_Nb>& __rhs) const
+ operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return _M_base() == __rhs; }
bool
- operator!=(const bitset<_Nb>& __rhs) const
+ operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return _M_base() != __rhs; }
using _Base::test;
using _Base::none;
bitset<_Nb>
- operator<<(size_t __pos) const
+ operator<<(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(_M_base() << __pos); }
bitset<_Nb>
- operator>>(size_t __pos) const
+ operator>>(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(_M_base() >> __pos); }
- _Base&
- _M_base() { return *this; }
+ _Base&
+ _M_base() _GLIBCXX_NOEXCEPT
+ { return *this; }
const _Base&
- _M_base() const { return *this; }
+ _M_base() const _GLIBCXX_NOEXCEPT
+ { return *this; }
};
template<size_t _Nb>
bitset<_Nb>
- operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(__x) &= __y; }
template<size_t _Nb>
bitset<_Nb>
- operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(__x) |= __y; }
template<size_t _Nb>
bitset<_Nb>
- operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(__x) ^= __y; }
template<typename _CharT, typename _Traits, size_t _Nb>
// Profiling bitset implementation -*- C++ -*-
-// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
friend class bitset;
reference();
- reference(const _Base_ref& __base, bitset* __seq)
+ reference(const _Base_ref& __base, bitset* __seq) _GLIBCXX_NOEXCEPT
: _Base_ref(__base)
{ }
public:
- reference(const reference& __x)
+ reference(const reference& __x) _GLIBCXX_NOEXCEPT
: _Base_ref(__x)
{ }
reference&
- operator=(bool __x)
+ operator=(bool __x) _GLIBCXX_NOEXCEPT
{
*static_cast<_Base_ref*>(this) = __x;
return *this;
}
reference&
- operator=(const reference& __x)
+ operator=(const reference& __x) _GLIBCXX_NOEXCEPT
{
*static_cast<_Base_ref*>(this) = __x;
return *this;
}
bool
- operator~() const
+ operator~() const _GLIBCXX_NOEXCEPT
{
return ~(*static_cast<const _Base_ref*>(this));
}
- operator bool() const
+ operator bool() const _GLIBCXX_NOEXCEPT
{
return *static_cast<const _Base_ref*>(this);
}
reference&
- flip()
+ flip() _GLIBCXX_NOEXCEPT
{
_Base_ref::flip();
return *this;
};
// 23.3.5.1 constructors:
- _GLIBCXX_CONSTEXPR bitset() : _Base() { }
+ _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT
+ : _Base() { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- constexpr bitset(unsigned long long __val)
+ constexpr bitset(unsigned long long __val) noexcept
#else
bitset(unsigned long __val)
#endif
// 23.3.5.2 bitset operations:
bitset<_Nb>&
- operator&=(const bitset<_Nb>& __rhs)
+ operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{
_M_base() &= __rhs;
return *this;
}
bitset<_Nb>&
- operator|=(const bitset<_Nb>& __rhs)
+ operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{
_M_base() |= __rhs;
return *this;
}
bitset<_Nb>&
- operator^=(const bitset<_Nb>& __rhs)
+ operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{
_M_base() ^= __rhs;
return *this;
}
bitset<_Nb>&
- operator<<=(size_t __pos)
+ operator<<=(size_t __pos) _GLIBCXX_NOEXCEPT
{
_M_base() <<= __pos;
return *this;
}
bitset<_Nb>&
- operator>>=(size_t __pos)
+ operator>>=(size_t __pos) _GLIBCXX_NOEXCEPT
{
_M_base() >>= __pos;
return *this;
}
bitset<_Nb>&
- set()
+ set() _GLIBCXX_NOEXCEPT
{
_Base::set();
return *this;
}
bitset<_Nb>&
- reset()
+ reset() _GLIBCXX_NOEXCEPT
{
_Base::reset();
return *this;
return *this;
}
- bitset<_Nb> operator~() const { return bitset(~_M_base()); }
+ bitset<_Nb>
+ operator~() const _GLIBCXX_NOEXCEPT
+ { return bitset(~_M_base()); }
bitset<_Nb>&
- flip()
+ flip() _GLIBCXX_NOEXCEPT
{
_Base::flip();
return *this;
using _Base::size;
bool
- operator==(const bitset<_Nb>& __rhs) const
+ operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return _M_base() == __rhs; }
bool
- operator!=(const bitset<_Nb>& __rhs) const
+ operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return _M_base() != __rhs; }
using _Base::test;
using _Base::none;
bitset<_Nb>
- operator<<(size_t __pos) const
+ operator<<(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(_M_base() << __pos); }
bitset<_Nb>
- operator>>(size_t __pos) const
+ operator>>(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(_M_base() >> __pos); }
_Base&
- _M_base() { return *this; }
+ _M_base() _GLIBCXX_NOEXCEPT
+ { return *this; }
const _Base&
- _M_base() const { return *this; }
+ _M_base() const _GLIBCXX_NOEXCEPT
+ { return *this; }
};
template<size_t _Nb>
bitset<_Nb>
- operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(__x) &= __y; }
template<size_t _Nb>
bitset<_Nb>
- operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(__x) |= __y; }
template<size_t _Nb>
bitset<_Nb>
- operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(__x) ^= __y; }
template<typename _CharT, typename _Traits, size_t _Nb>
/// 0 is the least significant word.
_WordT _M_w[_Nw];
- _GLIBCXX_CONSTEXPR _Base_bitset()
+ _GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_NOEXCEPT
: _M_w() { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- constexpr _Base_bitset(unsigned long long __val)
+ constexpr _Base_bitset(unsigned long long __val) noexcept
: _M_w{ _WordT(__val)
#if __SIZEOF_LONG_LONG__ > __SIZEOF_LONG__
, _WordT(__val >> _GLIBCXX_BITSET_BITS_PER_WORD)
#endif
static _GLIBCXX_CONSTEXPR size_t
- _S_whichword(size_t __pos )
+ _S_whichword(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
static _GLIBCXX_CONSTEXPR size_t
- _S_whichbyte(size_t __pos )
+ _S_whichbyte(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
static _GLIBCXX_CONSTEXPR size_t
- _S_whichbit(size_t __pos )
+ _S_whichbit(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
static _GLIBCXX_CONSTEXPR _WordT
- _S_maskbit(size_t __pos )
+ _S_maskbit(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
_WordT&
- _M_getword(size_t __pos)
+ _M_getword(size_t __pos) _GLIBCXX_NOEXCEPT
{ return _M_w[_S_whichword(__pos)]; }
_WordT
- _M_getword(size_t __pos) const
+ _M_getword(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return _M_w[_S_whichword(__pos)]; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
const _WordT*
- _M_getdata() const
+ _M_getdata() const noexcept
{ return _M_w; }
#endif
_WordT&
- _M_hiword()
+ _M_hiword() _GLIBCXX_NOEXCEPT
{ return _M_w[_Nw - 1]; }
_GLIBCXX_CONSTEXPR _WordT
- _M_hiword() const
+ _M_hiword() const _GLIBCXX_NOEXCEPT
{ return _M_w[_Nw - 1]; }
void
- _M_do_and(const _Base_bitset<_Nw>& __x)
+ _M_do_and(const _Base_bitset<_Nw>& __x) _GLIBCXX_NOEXCEPT
{
for (size_t __i = 0; __i < _Nw; __i++)
_M_w[__i] &= __x._M_w[__i];
}
void
- _M_do_or(const _Base_bitset<_Nw>& __x)
+ _M_do_or(const _Base_bitset<_Nw>& __x) _GLIBCXX_NOEXCEPT
{
for (size_t __i = 0; __i < _Nw; __i++)
_M_w[__i] |= __x._M_w[__i];
}
void
- _M_do_xor(const _Base_bitset<_Nw>& __x)
+ _M_do_xor(const _Base_bitset<_Nw>& __x) _GLIBCXX_NOEXCEPT
{
for (size_t __i = 0; __i < _Nw; __i++)
_M_w[__i] ^= __x._M_w[__i];
}
void
- _M_do_left_shift(size_t __shift);
+ _M_do_left_shift(size_t __shift) _GLIBCXX_NOEXCEPT;
void
- _M_do_right_shift(size_t __shift);
+ _M_do_right_shift(size_t __shift) _GLIBCXX_NOEXCEPT;
void
- _M_do_flip()
+ _M_do_flip() _GLIBCXX_NOEXCEPT
{
for (size_t __i = 0; __i < _Nw; __i++)
_M_w[__i] = ~_M_w[__i];
}
void
- _M_do_set()
+ _M_do_set() _GLIBCXX_NOEXCEPT
{
for (size_t __i = 0; __i < _Nw; __i++)
_M_w[__i] = ~static_cast<_WordT>(0);
}
void
- _M_do_reset()
+ _M_do_reset() _GLIBCXX_NOEXCEPT
{ __builtin_memset(_M_w, 0, _Nw * sizeof(_WordT)); }
bool
- _M_is_equal(const _Base_bitset<_Nw>& __x) const
+ _M_is_equal(const _Base_bitset<_Nw>& __x) const _GLIBCXX_NOEXCEPT
{
for (size_t __i = 0; __i < _Nw; ++__i)
if (_M_w[__i] != __x._M_w[__i])
}
size_t
- _M_are_all_aux() const
+ _M_are_all_aux() const _GLIBCXX_NOEXCEPT
{
for (size_t __i = 0; __i < _Nw - 1; __i++)
if (_M_w[__i] != ~static_cast<_WordT>(0))
}
bool
- _M_is_any() const
+ _M_is_any() const _GLIBCXX_NOEXCEPT
{
for (size_t __i = 0; __i < _Nw; __i++)
if (_M_w[__i] != static_cast<_WordT>(0))
}
size_t
- _M_do_count() const
+ _M_do_count() const _GLIBCXX_NOEXCEPT
{
size_t __result = 0;
for (size_t __i = 0; __i < _Nw; __i++)
// find first "on" bit
size_t
- _M_do_find_first(size_t __not_found) const;
+ _M_do_find_first(size_t __not_found) const _GLIBCXX_NOEXCEPT;
// find the next "on" bit that follows "prev"
size_t
- _M_do_find_next(size_t __prev, size_t __not_found) const;
+ _M_do_find_next(size_t __prev, size_t __not_found) const
+ _GLIBCXX_NOEXCEPT;
};
// Definitions of non-inline functions from _Base_bitset.
template<size_t _Nw>
void
- _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift)
+ _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift) _GLIBCXX_NOEXCEPT
{
if (__builtin_expect(__shift != 0, 1))
{
template<size_t _Nw>
void
- _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift)
+ _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift) _GLIBCXX_NOEXCEPT
{
if (__builtin_expect(__shift != 0, 1))
{
template<size_t _Nw>
size_t
- _Base_bitset<_Nw>::_M_do_find_first(size_t __not_found) const
+ _Base_bitset<_Nw>::
+ _M_do_find_first(size_t __not_found) const _GLIBCXX_NOEXCEPT
{
for (size_t __i = 0; __i < _Nw; __i++)
{
template<size_t _Nw>
size_t
- _Base_bitset<_Nw>::_M_do_find_next(size_t __prev, size_t __not_found) const
+ _Base_bitset<_Nw>::
+ _M_do_find_next(size_t __prev, size_t __not_found) const _GLIBCXX_NOEXCEPT
{
// make bound inclusive
++__prev;
typedef unsigned long _WordT;
_WordT _M_w;
- _GLIBCXX_CONSTEXPR _Base_bitset()
+ _GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_NOEXCEPT
: _M_w(0)
{ }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- constexpr _Base_bitset(unsigned long long __val)
+ constexpr _Base_bitset(unsigned long long __val) noexcept
#else
_Base_bitset(unsigned long __val)
#endif
{ }
static _GLIBCXX_CONSTEXPR size_t
- _S_whichword(size_t __pos )
+ _S_whichword(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
static _GLIBCXX_CONSTEXPR size_t
- _S_whichbyte(size_t __pos )
+ _S_whichbyte(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
static _GLIBCXX_CONSTEXPR size_t
- _S_whichbit(size_t __pos )
+ _S_whichbit(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
static _GLIBCXX_CONSTEXPR _WordT
- _S_maskbit(size_t __pos )
+ _S_maskbit(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
_WordT&
- _M_getword(size_t)
+ _M_getword(size_t) _GLIBCXX_NOEXCEPT
{ return _M_w; }
_WordT
- _M_getword(size_t) const
+ _M_getword(size_t) const _GLIBCXX_NOEXCEPT
{ return _M_w; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
const _WordT*
- _M_getdata() const
+ _M_getdata() const noexcept
{ return &_M_w; }
#endif
_WordT&
- _M_hiword()
+ _M_hiword() _GLIBCXX_NOEXCEPT
{ return _M_w; }
_GLIBCXX_CONSTEXPR _WordT
- _M_hiword() const
+ _M_hiword() const _GLIBCXX_NOEXCEPT
{ return _M_w; }
void
- _M_do_and(const _Base_bitset<1>& __x)
+ _M_do_and(const _Base_bitset<1>& __x) _GLIBCXX_NOEXCEPT
{ _M_w &= __x._M_w; }
void
- _M_do_or(const _Base_bitset<1>& __x)
+ _M_do_or(const _Base_bitset<1>& __x) _GLIBCXX_NOEXCEPT
{ _M_w |= __x._M_w; }
void
- _M_do_xor(const _Base_bitset<1>& __x)
+ _M_do_xor(const _Base_bitset<1>& __x) _GLIBCXX_NOEXCEPT
{ _M_w ^= __x._M_w; }
void
- _M_do_left_shift(size_t __shift)
+ _M_do_left_shift(size_t __shift) _GLIBCXX_NOEXCEPT
{ _M_w <<= __shift; }
void
- _M_do_right_shift(size_t __shift)
+ _M_do_right_shift(size_t __shift) _GLIBCXX_NOEXCEPT
{ _M_w >>= __shift; }
void
- _M_do_flip()
+ _M_do_flip() _GLIBCXX_NOEXCEPT
{ _M_w = ~_M_w; }
void
- _M_do_set()
+ _M_do_set() _GLIBCXX_NOEXCEPT
{ _M_w = ~static_cast<_WordT>(0); }
void
- _M_do_reset()
+ _M_do_reset() _GLIBCXX_NOEXCEPT
{ _M_w = 0; }
bool
- _M_is_equal(const _Base_bitset<1>& __x) const
+ _M_is_equal(const _Base_bitset<1>& __x) const _GLIBCXX_NOEXCEPT
{ return _M_w == __x._M_w; }
size_t
- _M_are_all_aux() const
+ _M_are_all_aux() const _GLIBCXX_NOEXCEPT
{ return __builtin_popcountl(_M_w); }
bool
- _M_is_any() const
+ _M_is_any() const _GLIBCXX_NOEXCEPT
{ return _M_w != 0; }
size_t
- _M_do_count() const
+ _M_do_count() const _GLIBCXX_NOEXCEPT
{ return __builtin_popcountl(_M_w); }
unsigned long
- _M_do_to_ulong() const
+ _M_do_to_ulong() const _GLIBCXX_NOEXCEPT
{ return _M_w; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
unsigned long long
- _M_do_to_ullong() const
+ _M_do_to_ullong() const noexcept
{ return _M_w; }
#endif
size_t
- _M_do_find_first(size_t __not_found) const
+ _M_do_find_first(size_t __not_found) const _GLIBCXX_NOEXCEPT
{
if (_M_w != 0)
return __builtin_ctzl(_M_w);
// find the next "on" bit that follows "prev"
size_t
_M_do_find_next(size_t __prev, size_t __not_found) const
+ _GLIBCXX_NOEXCEPT
{
++__prev;
if (__prev >= ((size_t) _GLIBCXX_BITSET_BITS_PER_WORD))
{
typedef unsigned long _WordT;
- _GLIBCXX_CONSTEXPR _Base_bitset()
+ _GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_NOEXCEPT
{ }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- constexpr _Base_bitset(unsigned long long)
+ constexpr _Base_bitset(unsigned long long) noexcept
#else
_Base_bitset(unsigned long)
#endif
{ }
static _GLIBCXX_CONSTEXPR size_t
- _S_whichword(size_t __pos )
+ _S_whichword(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
static _GLIBCXX_CONSTEXPR size_t
- _S_whichbyte(size_t __pos )
+ _S_whichbyte(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
static _GLIBCXX_CONSTEXPR size_t
- _S_whichbit(size_t __pos )
+ _S_whichbit(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
static _GLIBCXX_CONSTEXPR _WordT
- _S_maskbit(size_t __pos )
+ _S_maskbit(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
// This would normally give access to the data. The bounds-checking
// make an unchecked call; all the memory ugliness is therefore
// localized to this single should-never-get-this-far function.
_WordT&
- _M_getword(size_t)
- {
+ _M_getword(size_t) _GLIBCXX_NOEXCEPT
+ {
__throw_out_of_range(__N("_Base_bitset::_M_getword"));
- return *new _WordT;
+ return *new _WordT;
}
_WordT
- _M_getword(size_t __pos) const
+ _M_getword(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return 0; }
_GLIBCXX_CONSTEXPR _WordT
- _M_hiword() const
+ _M_hiword() const _GLIBCXX_NOEXCEPT
{ return 0; }
void
- _M_do_and(const _Base_bitset<0>&)
+ _M_do_and(const _Base_bitset<0>&) _GLIBCXX_NOEXCEPT
{ }
void
- _M_do_or(const _Base_bitset<0>&)
+ _M_do_or(const _Base_bitset<0>&) _GLIBCXX_NOEXCEPT
{ }
void
- _M_do_xor(const _Base_bitset<0>&)
+ _M_do_xor(const _Base_bitset<0>&) _GLIBCXX_NOEXCEPT
{ }
void
- _M_do_left_shift(size_t)
+ _M_do_left_shift(size_t) _GLIBCXX_NOEXCEPT
{ }
void
- _M_do_right_shift(size_t)
+ _M_do_right_shift(size_t) _GLIBCXX_NOEXCEPT
{ }
void
- _M_do_flip()
+ _M_do_flip() _GLIBCXX_NOEXCEPT
{ }
void
- _M_do_set()
+ _M_do_set() _GLIBCXX_NOEXCEPT
{ }
void
- _M_do_reset()
+ _M_do_reset() _GLIBCXX_NOEXCEPT
{ }
// Are all empty bitsets equal to each other? Are they equal to
// themselves? How to compare a thing which has no state? What is
// the sound of one zero-length bitset clapping?
bool
- _M_is_equal(const _Base_bitset<0>&) const
+ _M_is_equal(const _Base_bitset<0>&) const _GLIBCXX_NOEXCEPT
{ return true; }
size_t
- _M_are_all_aux() const
+ _M_are_all_aux() const _GLIBCXX_NOEXCEPT
{ return 0; }
bool
- _M_is_any() const
+ _M_is_any() const _GLIBCXX_NOEXCEPT
{ return false; }
size_t
- _M_do_count() const
+ _M_do_count() const _GLIBCXX_NOEXCEPT
{ return 0; }
unsigned long
- _M_do_to_ulong() const
+ _M_do_to_ulong() const _GLIBCXX_NOEXCEPT
{ return 0; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
unsigned long long
- _M_do_to_ullong() const
+ _M_do_to_ullong() const noexcept
{ return 0; }
#endif
// Normally "not found" is the size, but that could also be
// misinterpreted as an index in this corner case. Oh well.
size_t
- _M_do_find_first(size_t) const
+ _M_do_find_first(size_t) const _GLIBCXX_NOEXCEPT
{ return 0; }
size_t
- _M_do_find_next(size_t, size_t) const
+ _M_do_find_next(size_t, size_t) const _GLIBCXX_NOEXCEPT
{ return 0; }
};
typedef unsigned long _WordT;
static void
- _S_do_sanitize(_WordT& __val)
+ _S_do_sanitize(_WordT& __val) _GLIBCXX_NOEXCEPT
{ __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); }
};
typedef unsigned long _WordT;
static void
- _S_do_sanitize(_WordT) { }
+ _S_do_sanitize(_WordT) _GLIBCXX_NOEXCEPT { }
};
/**
typedef unsigned long _WordT;
void
- _M_do_sanitize()
+ _M_do_sanitize() _GLIBCXX_NOEXCEPT
{
typedef _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD> __sanitize_type;
__sanitize_type::_S_do_sanitize(this->_M_hiword());
reference();
public:
- reference(bitset& __b, size_t __pos)
+ reference(bitset& __b, size_t __pos) _GLIBCXX_NOEXCEPT
{
_M_wp = &__b._M_getword(__pos);
_M_bpos = _Base::_S_whichbit(__pos);
}
- ~reference()
+ ~reference() _GLIBCXX_NOEXCEPT
{ }
// For b[i] = __x;
reference&
- operator=(bool __x)
+ operator=(bool __x) _GLIBCXX_NOEXCEPT
{
if (__x)
*_M_wp |= _Base::_S_maskbit(_M_bpos);
// For b[i] = b[__j];
reference&
- operator=(const reference& __j)
+ operator=(const reference& __j) _GLIBCXX_NOEXCEPT
{
if ((*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos)))
*_M_wp |= _Base::_S_maskbit(_M_bpos);
// Flips the bit
bool
- operator~() const
+ operator~() const _GLIBCXX_NOEXCEPT
{ return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; }
// For __x = b[i];
- operator bool() const
+ operator bool() const _GLIBCXX_NOEXCEPT
{ return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; }
// For b[i].flip();
reference&
- flip()
+ flip() _GLIBCXX_NOEXCEPT
{
*_M_wp ^= _Base::_S_maskbit(_M_bpos);
return *this;
// 23.3.5.1 constructors:
/// All bits set to zero.
- _GLIBCXX_CONSTEXPR bitset()
+ _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT
{ }
/// Initial bits bitwise-copied from a single word (others set to zero).
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- constexpr bitset(unsigned long long __val)
+ constexpr bitset(unsigned long long __val) noexcept
: _Base(__val) { }
#else
bitset(unsigned long __val)
* These should be self-explanatory.
*/
bitset<_Nb>&
- operator&=(const bitset<_Nb>& __rhs)
+ operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{
this->_M_do_and(__rhs);
return *this;
}
bitset<_Nb>&
- operator|=(const bitset<_Nb>& __rhs)
+ operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{
this->_M_do_or(__rhs);
return *this;
}
bitset<_Nb>&
- operator^=(const bitset<_Nb>& __rhs)
+ operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{
this->_M_do_xor(__rhs);
return *this;
* These should be self-explanatory.
*/
bitset<_Nb>&
- operator<<=(size_t __position)
+ operator<<=(size_t __position) _GLIBCXX_NOEXCEPT
{
if (__builtin_expect(__position < _Nb, 1))
{
}
bitset<_Nb>&
- operator>>=(size_t __position)
+ operator>>=(size_t __position) _GLIBCXX_NOEXCEPT
{
if (__builtin_expect(__position < _Nb, 1))
{
* @ingroup SGIextensions
*/
bitset<_Nb>&
- _Unchecked_set(size_t __pos)
+ _Unchecked_set(size_t __pos) _GLIBCXX_NOEXCEPT
{
this->_M_getword(__pos) |= _Base::_S_maskbit(__pos);
return *this;
}
bitset<_Nb>&
- _Unchecked_set(size_t __pos, int __val)
+ _Unchecked_set(size_t __pos, int __val) _GLIBCXX_NOEXCEPT
{
if (__val)
this->_M_getword(__pos) |= _Base::_S_maskbit(__pos);
}
bitset<_Nb>&
- _Unchecked_reset(size_t __pos)
+ _Unchecked_reset(size_t __pos) _GLIBCXX_NOEXCEPT
{
this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos);
return *this;
}
bitset<_Nb>&
- _Unchecked_flip(size_t __pos)
+ _Unchecked_flip(size_t __pos) _GLIBCXX_NOEXCEPT
{
this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos);
return *this;
}
bool
- _Unchecked_test(size_t __pos) const
+ _Unchecked_test(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return ((this->_M_getword(__pos) & _Base::_S_maskbit(__pos))
!= static_cast<_WordT>(0)); }
//@}
* @brief Sets every bit to true.
*/
bitset<_Nb>&
- set()
+ set() _GLIBCXX_NOEXCEPT
{
this->_M_do_set();
this->_M_do_sanitize();
* @brief Sets every bit to false.
*/
bitset<_Nb>&
- reset()
+ reset() _GLIBCXX_NOEXCEPT
{
this->_M_do_reset();
return *this;
* @brief Toggles every bit to its opposite value.
*/
bitset<_Nb>&
- flip()
+ flip() _GLIBCXX_NOEXCEPT
{
this->_M_do_flip();
this->_M_do_sanitize();
/// See the no-argument flip().
bitset<_Nb>
- operator~() const
+ operator~() const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(*this).flip(); }
//@{
/// Returns the number of bits which are set.
size_t
- count() const
+ count() const _GLIBCXX_NOEXCEPT
{ return this->_M_do_count(); }
/// Returns the total number of bits.
_GLIBCXX_CONSTEXPR size_t
- size() const
+ size() const _GLIBCXX_NOEXCEPT
{ return _Nb; }
//@{
/// These comparisons for equality/inequality are, well, @e bitwise.
bool
- operator==(const bitset<_Nb>& __rhs) const
+ operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return this->_M_is_equal(__rhs); }
bool
- operator!=(const bitset<_Nb>& __rhs) const
+ operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return !this->_M_is_equal(__rhs); }
//@}
* @return True if all the bits are set.
*/
bool
- all() const
+ all() const _GLIBCXX_NOEXCEPT
{ return this->_M_are_all_aux() == _Nb; }
/**
* @return True if at least one bit is set.
*/
bool
- any() const
+ any() const _GLIBCXX_NOEXCEPT
{ return this->_M_is_any(); }
/**
* @return True if none of the bits are set.
*/
bool
- none() const
+ none() const _GLIBCXX_NOEXCEPT
{ return !this->_M_is_any(); }
//@{
/// Self-explanatory.
bitset<_Nb>
- operator<<(size_t __position) const
+ operator<<(size_t __position) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(*this) <<= __position; }
bitset<_Nb>
- operator>>(size_t __position) const
+ operator>>(size_t __position) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(*this) >>= __position; }
//@}
* @sa _Find_next
*/
size_t
- _Find_first() const
+ _Find_first() const _GLIBCXX_NOEXCEPT
{ return this->_M_do_find_first(_Nb); }
/**
* @sa _Find_first
*/
size_t
- _Find_next(size_t __prev ) const
+ _Find_next(size_t __prev ) const _GLIBCXX_NOEXCEPT
{ return this->_M_do_find_next(__prev, _Nb); }
};
*/
template<size_t _Nb>
inline bitset<_Nb>
- operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
{
bitset<_Nb> __result(__x);
__result &= __y;
template<size_t _Nb>
inline bitset<_Nb>
- operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
{
bitset<_Nb> __result(__x);
__result |= __y;
template <size_t _Nb>
inline bitset<_Nb>
- operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
{
bitset<_Nb> __result(__x);
__result ^= __y;