Commit 5d861bf2 by Paolo Carlini Committed by Paolo Carlini

initializer_list: Use noexcept specifier.

2011-05-18  Paolo Carlini  <paolo.carlini@oracle.com>

	* libsupc++/initializer_list: Use noexcept specifier.
	(initializer_list<>::size, begin, end): Qualify as const.
	* include/bits/move.h (__addressof, forward, move, addressof): Specify
	as noexcept.
	* include/std/bitset: Use noexcept specifier throughout.
	* include/debug/bitset: Update.
	* include/profile/bitset: Likewise.

From-SVN: r173871
parent 0bda47a3
2011-05-18 Paolo Carlini <paolo.carlini@oracle.com>
* libsupc++/initializer_list: Use noexcept specifier.
(initializer_list<>::size, begin, end): Qualify as const.
* include/bits/move.h (__addressof, forward, move, addressof): Specify
as noexcept.
* include/std/bitset: Use noexcept specifier throughout.
* include/debug/bitset: Update.
* include/profile/bitset: Likewise.
2011-05-17 Paolo Carlini <paolo.carlini@oracle.com> 2011-05-17 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/tuple: Use noexcept where appropriate. * include/std/tuple: Use noexcept where appropriate.
......
...@@ -40,7 +40,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -40,7 +40,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Used, in C++03 mode too, by allocators, etc. // Used, in C++03 mode too, by allocators, etc.
template<typename _Tp> template<typename _Tp>
inline _Tp* inline _Tp*
__addressof(_Tp& __r) __addressof(_Tp& __r) _GLIBCXX_NOEXCEPT
{ {
return reinterpret_cast<_Tp*> return reinterpret_cast<_Tp*>
(&const_cast<char&>(reinterpret_cast<const volatile char&>(__r))); (&const_cast<char&>(reinterpret_cast<const volatile char&>(__r)));
...@@ -59,12 +59,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -59,12 +59,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// forward (as per N3143) /// forward (as per N3143)
template<typename _Tp> template<typename _Tp>
inline _Tp&& inline _Tp&&
forward(typename std::remove_reference<_Tp>::type& __t) forward(typename std::remove_reference<_Tp>::type& __t) noexcept
{ return static_cast<_Tp&&>(__t); } { return static_cast<_Tp&&>(__t); }
template<typename _Tp> template<typename _Tp>
inline _Tp&& inline _Tp&&
forward(typename std::remove_reference<_Tp>::type&& __t) forward(typename std::remove_reference<_Tp>::type&& __t) noexcept
{ {
static_assert(!std::is_lvalue_reference<_Tp>::value, "template argument" static_assert(!std::is_lvalue_reference<_Tp>::value, "template argument"
" substituting _Tp is an lvalue reference type"); " substituting _Tp is an lvalue reference type");
...@@ -79,7 +79,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -79,7 +79,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _Tp> template<typename _Tp>
inline typename std::remove_reference<_Tp>::type&& inline typename std::remove_reference<_Tp>::type&&
move(_Tp&& __t) move(_Tp&& __t) noexcept
{ return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); } { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
/** /**
...@@ -108,7 +108,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -108,7 +108,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _Tp> template<typename _Tp>
inline _Tp* inline _Tp*
addressof(_Tp& __r) addressof(_Tp& __r) noexcept
{ return std::__addressof(__r); } { return std::__addressof(__r); }
_GLIBCXX_END_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION
...@@ -135,6 +135,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -135,6 +135,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp> template<typename _Tp>
inline void inline void
swap(_Tp& __a, _Tp& __b) swap(_Tp& __a, _Tp& __b)
// noexcept has to wait is_nothrow_move_assignable
{ {
// concept requirements // concept requirements
__glibcxx_function_requires(_SGIAssignableConcept<_Tp>) __glibcxx_function_requires(_SGIAssignableConcept<_Tp>)
...@@ -149,6 +150,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -149,6 +150,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp, size_t _Nm> template<typename _Tp, size_t _Nm>
inline void inline void
swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
// noexcept waits for c++/49045
{ {
for (size_t __n = 0; __n < _Nm; ++__n) for (size_t __n = 0; __n < _Nm; ++__n)
swap(__a[__n], __b[__n]); swap(__a[__n], __b[__n]);
......
// Debugging bitset implementation -*- C++ -*- // 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. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -66,19 +66,19 @@ namespace __debug ...@@ -66,19 +66,19 @@ namespace __debug
reference(); reference();
reference(const _Base_ref& __base, reference(const _Base_ref& __base,
bitset* __seq __attribute__((__unused__))) bitset* __seq __attribute__((__unused__))) _GLIBCXX_NOEXCEPT
: _Base_ref(__base) : _Base_ref(__base)
, _Safe_iterator_base(__seq, false) , _Safe_iterator_base(__seq, false)
{ } { }
public: public:
reference(const reference& __x) reference(const reference& __x) _GLIBCXX_NOEXCEPT
: _Base_ref(__x) : _Base_ref(__x)
, _Safe_iterator_base(__x, false) , _Safe_iterator_base(__x, false)
{ } { }
reference& reference&
operator=(bool __x) operator=(bool __x) _GLIBCXX_NOEXCEPT
{ {
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_write) _M_message(__gnu_debug::__msg_bad_bitset_write)
...@@ -88,7 +88,7 @@ namespace __debug ...@@ -88,7 +88,7 @@ namespace __debug
} }
reference& reference&
operator=(const reference& __x) operator=(const reference& __x) _GLIBCXX_NOEXCEPT
{ {
_GLIBCXX_DEBUG_VERIFY(! __x._M_singular(), _GLIBCXX_DEBUG_VERIFY(! __x._M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_read) _M_message(__gnu_debug::__msg_bad_bitset_read)
...@@ -101,7 +101,7 @@ namespace __debug ...@@ -101,7 +101,7 @@ namespace __debug
} }
bool bool
operator~() const operator~() const _GLIBCXX_NOEXCEPT
{ {
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_read) _M_message(__gnu_debug::__msg_bad_bitset_read)
...@@ -109,7 +109,7 @@ namespace __debug ...@@ -109,7 +109,7 @@ namespace __debug
return ~(*static_cast<const _Base_ref*>(this)); return ~(*static_cast<const _Base_ref*>(this));
} }
operator bool() const operator bool() const _GLIBCXX_NOEXCEPT
{ {
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_read) _M_message(__gnu_debug::__msg_bad_bitset_read)
...@@ -118,7 +118,7 @@ namespace __debug ...@@ -118,7 +118,7 @@ namespace __debug
} }
reference& reference&
flip() flip() _GLIBCXX_NOEXCEPT
{ {
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__gnu_debug::__msg_bad_bitset_flip) _M_message(__gnu_debug::__msg_bad_bitset_flip)
...@@ -130,10 +130,11 @@ namespace __debug ...@@ -130,10 +130,11 @@ namespace __debug
#endif #endif
// 23.3.5.1 constructors: // 23.3.5.1 constructors:
_GLIBCXX_CONSTEXPR bitset() : _Base() { } _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT
: _Base() { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
constexpr bitset(unsigned long long __val) constexpr bitset(unsigned long long __val) noexcept
#else #else
bitset(unsigned long __val) bitset(unsigned long __val)
#endif #endif
...@@ -173,42 +174,42 @@ namespace __debug ...@@ -173,42 +174,42 @@ namespace __debug
// 23.3.5.2 bitset operations: // 23.3.5.2 bitset operations:
bitset<_Nb>& bitset<_Nb>&
operator&=(const bitset<_Nb>& __rhs) operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{ {
_M_base() &= __rhs; _M_base() &= __rhs;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator|=(const bitset<_Nb>& __rhs) operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{ {
_M_base() |= __rhs; _M_base() |= __rhs;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator^=(const bitset<_Nb>& __rhs) operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{ {
_M_base() ^= __rhs; _M_base() ^= __rhs;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator<<=(size_t __pos) operator<<=(size_t __pos) _GLIBCXX_NOEXCEPT
{ {
_M_base() <<= __pos; _M_base() <<= __pos;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator>>=(size_t __pos) operator>>=(size_t __pos) _GLIBCXX_NOEXCEPT
{ {
_M_base() >>= __pos; _M_base() >>= __pos;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
set() set() _GLIBCXX_NOEXCEPT
{ {
_Base::set(); _Base::set();
return *this; return *this;
...@@ -224,7 +225,7 @@ namespace __debug ...@@ -224,7 +225,7 @@ namespace __debug
} }
bitset<_Nb>& bitset<_Nb>&
reset() reset() _GLIBCXX_NOEXCEPT
{ {
_Base::reset(); _Base::reset();
return *this; return *this;
...@@ -237,10 +238,12 @@ namespace __debug ...@@ -237,10 +238,12 @@ namespace __debug
return *this; return *this;
} }
bitset<_Nb> operator~() const { return bitset(~_M_base()); } bitset<_Nb>
operator~() const _GLIBCXX_NOEXCEPT
{ return bitset(~_M_base()); }
bitset<_Nb>& bitset<_Nb>&
flip() flip() _GLIBCXX_NOEXCEPT
{ {
_Base::flip(); _Base::flip();
return *this; return *this;
...@@ -346,11 +349,11 @@ namespace __debug ...@@ -346,11 +349,11 @@ namespace __debug
using _Base::size; using _Base::size;
bool bool
operator==(const bitset<_Nb>& __rhs) const operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return _M_base() == __rhs; } { return _M_base() == __rhs; }
bool bool
operator!=(const bitset<_Nb>& __rhs) const operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return _M_base() != __rhs; } { return _M_base() != __rhs; }
using _Base::test; using _Base::test;
...@@ -359,33 +362,35 @@ namespace __debug ...@@ -359,33 +362,35 @@ namespace __debug
using _Base::none; using _Base::none;
bitset<_Nb> bitset<_Nb>
operator<<(size_t __pos) const operator<<(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(_M_base() << __pos); } { return bitset<_Nb>(_M_base() << __pos); }
bitset<_Nb> bitset<_Nb>
operator>>(size_t __pos) const operator>>(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(_M_base() >> __pos); } { return bitset<_Nb>(_M_base() >> __pos); }
_Base& _Base&
_M_base() { return *this; } _M_base() _GLIBCXX_NOEXCEPT
{ return *this; }
const _Base& const _Base&
_M_base() const { return *this; } _M_base() const _GLIBCXX_NOEXCEPT
{ return *this; }
}; };
template<size_t _Nb> template<size_t _Nb>
bitset<_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; } { return bitset<_Nb>(__x) &= __y; }
template<size_t _Nb> template<size_t _Nb>
bitset<_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; } { return bitset<_Nb>(__x) |= __y; }
template<size_t _Nb> template<size_t _Nb>
bitset<_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; } { return bitset<_Nb>(__x) ^= __y; }
template<typename _CharT, typename _Traits, size_t _Nb> template<typename _CharT, typename _Traits, size_t _Nb>
......
// Profiling bitset implementation -*- C++ -*- // 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 // 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 // software; you can redistribute it and/or modify it under the
...@@ -52,42 +52,42 @@ namespace __profile ...@@ -52,42 +52,42 @@ namespace __profile
friend class bitset; friend class bitset;
reference(); reference();
reference(const _Base_ref& __base, bitset* __seq) reference(const _Base_ref& __base, bitset* __seq) _GLIBCXX_NOEXCEPT
: _Base_ref(__base) : _Base_ref(__base)
{ } { }
public: public:
reference(const reference& __x) reference(const reference& __x) _GLIBCXX_NOEXCEPT
: _Base_ref(__x) : _Base_ref(__x)
{ } { }
reference& reference&
operator=(bool __x) operator=(bool __x) _GLIBCXX_NOEXCEPT
{ {
*static_cast<_Base_ref*>(this) = __x; *static_cast<_Base_ref*>(this) = __x;
return *this; return *this;
} }
reference& reference&
operator=(const reference& __x) operator=(const reference& __x) _GLIBCXX_NOEXCEPT
{ {
*static_cast<_Base_ref*>(this) = __x; *static_cast<_Base_ref*>(this) = __x;
return *this; return *this;
} }
bool bool
operator~() const operator~() const _GLIBCXX_NOEXCEPT
{ {
return ~(*static_cast<const _Base_ref*>(this)); return ~(*static_cast<const _Base_ref*>(this));
} }
operator bool() const operator bool() const _GLIBCXX_NOEXCEPT
{ {
return *static_cast<const _Base_ref*>(this); return *static_cast<const _Base_ref*>(this);
} }
reference& reference&
flip() flip() _GLIBCXX_NOEXCEPT
{ {
_Base_ref::flip(); _Base_ref::flip();
return *this; return *this;
...@@ -95,10 +95,11 @@ namespace __profile ...@@ -95,10 +95,11 @@ namespace __profile
}; };
// 23.3.5.1 constructors: // 23.3.5.1 constructors:
_GLIBCXX_CONSTEXPR bitset() : _Base() { } _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT
: _Base() { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
constexpr bitset(unsigned long long __val) constexpr bitset(unsigned long long __val) noexcept
#else #else
bitset(unsigned long __val) bitset(unsigned long __val)
#endif #endif
...@@ -138,42 +139,42 @@ namespace __profile ...@@ -138,42 +139,42 @@ namespace __profile
// 23.3.5.2 bitset operations: // 23.3.5.2 bitset operations:
bitset<_Nb>& bitset<_Nb>&
operator&=(const bitset<_Nb>& __rhs) operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{ {
_M_base() &= __rhs; _M_base() &= __rhs;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator|=(const bitset<_Nb>& __rhs) operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{ {
_M_base() |= __rhs; _M_base() |= __rhs;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator^=(const bitset<_Nb>& __rhs) operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{ {
_M_base() ^= __rhs; _M_base() ^= __rhs;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator<<=(size_t __pos) operator<<=(size_t __pos) _GLIBCXX_NOEXCEPT
{ {
_M_base() <<= __pos; _M_base() <<= __pos;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator>>=(size_t __pos) operator>>=(size_t __pos) _GLIBCXX_NOEXCEPT
{ {
_M_base() >>= __pos; _M_base() >>= __pos;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
set() set() _GLIBCXX_NOEXCEPT
{ {
_Base::set(); _Base::set();
return *this; return *this;
...@@ -189,7 +190,7 @@ namespace __profile ...@@ -189,7 +190,7 @@ namespace __profile
} }
bitset<_Nb>& bitset<_Nb>&
reset() reset() _GLIBCXX_NOEXCEPT
{ {
_Base::reset(); _Base::reset();
return *this; return *this;
...@@ -202,10 +203,12 @@ namespace __profile ...@@ -202,10 +203,12 @@ namespace __profile
return *this; return *this;
} }
bitset<_Nb> operator~() const { return bitset(~_M_base()); } bitset<_Nb>
operator~() const _GLIBCXX_NOEXCEPT
{ return bitset(~_M_base()); }
bitset<_Nb>& bitset<_Nb>&
flip() flip() _GLIBCXX_NOEXCEPT
{ {
_Base::flip(); _Base::flip();
return *this; return *this;
...@@ -305,11 +308,11 @@ namespace __profile ...@@ -305,11 +308,11 @@ namespace __profile
using _Base::size; using _Base::size;
bool bool
operator==(const bitset<_Nb>& __rhs) const operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return _M_base() == __rhs; } { return _M_base() == __rhs; }
bool bool
operator!=(const bitset<_Nb>& __rhs) const operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return _M_base() != __rhs; } { return _M_base() != __rhs; }
using _Base::test; using _Base::test;
...@@ -318,33 +321,35 @@ namespace __profile ...@@ -318,33 +321,35 @@ namespace __profile
using _Base::none; using _Base::none;
bitset<_Nb> bitset<_Nb>
operator<<(size_t __pos) const operator<<(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(_M_base() << __pos); } { return bitset<_Nb>(_M_base() << __pos); }
bitset<_Nb> bitset<_Nb>
operator>>(size_t __pos) const operator>>(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(_M_base() >> __pos); } { return bitset<_Nb>(_M_base() >> __pos); }
_Base& _Base&
_M_base() { return *this; } _M_base() _GLIBCXX_NOEXCEPT
{ return *this; }
const _Base& const _Base&
_M_base() const { return *this; } _M_base() const _GLIBCXX_NOEXCEPT
{ return *this; }
}; };
template<size_t _Nb> template<size_t _Nb>
bitset<_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; } { return bitset<_Nb>(__x) &= __y; }
template<size_t _Nb> template<size_t _Nb>
bitset<_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; } { return bitset<_Nb>(__x) |= __y; }
template<size_t _Nb> template<size_t _Nb>
bitset<_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; } { return bitset<_Nb>(__x) ^= __y; }
template<typename _CharT, typename _Traits, size_t _Nb> template<typename _CharT, typename _Traits, size_t _Nb>
......
...@@ -75,11 +75,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -75,11 +75,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/// 0 is the least significant word. /// 0 is the least significant word.
_WordT _M_w[_Nw]; _WordT _M_w[_Nw];
_GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_NOEXCEPT
: _M_w() { } : _M_w() { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
constexpr _Base_bitset(unsigned long long __val) constexpr _Base_bitset(unsigned long long __val) noexcept
: _M_w{ _WordT(__val) : _M_w{ _WordT(__val)
#if __SIZEOF_LONG_LONG__ > __SIZEOF_LONG__ #if __SIZEOF_LONG_LONG__ > __SIZEOF_LONG__
, _WordT(__val >> _GLIBCXX_BITSET_BITS_PER_WORD) , _WordT(__val >> _GLIBCXX_BITSET_BITS_PER_WORD)
...@@ -92,90 +92,90 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -92,90 +92,90 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#endif #endif
static _GLIBCXX_CONSTEXPR size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichword(size_t __pos ) _S_whichword(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
static _GLIBCXX_CONSTEXPR size_t 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__; } { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
static _GLIBCXX_CONSTEXPR size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichbit(size_t __pos ) _S_whichbit(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
static _GLIBCXX_CONSTEXPR _WordT static _GLIBCXX_CONSTEXPR _WordT
_S_maskbit(size_t __pos ) _S_maskbit(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
_WordT& _WordT&
_M_getword(size_t __pos) _M_getword(size_t __pos) _GLIBCXX_NOEXCEPT
{ return _M_w[_S_whichword(__pos)]; } { return _M_w[_S_whichword(__pos)]; }
_WordT _WordT
_M_getword(size_t __pos) const _M_getword(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return _M_w[_S_whichword(__pos)]; } { return _M_w[_S_whichword(__pos)]; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
const _WordT* const _WordT*
_M_getdata() const _M_getdata() const noexcept
{ return _M_w; } { return _M_w; }
#endif #endif
_WordT& _WordT&
_M_hiword() _M_hiword() _GLIBCXX_NOEXCEPT
{ return _M_w[_Nw - 1]; } { return _M_w[_Nw - 1]; }
_GLIBCXX_CONSTEXPR _WordT _GLIBCXX_CONSTEXPR _WordT
_M_hiword() const _M_hiword() const _GLIBCXX_NOEXCEPT
{ return _M_w[_Nw - 1]; } { return _M_w[_Nw - 1]; }
void 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++) for (size_t __i = 0; __i < _Nw; __i++)
_M_w[__i] &= __x._M_w[__i]; _M_w[__i] &= __x._M_w[__i];
} }
void 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++) for (size_t __i = 0; __i < _Nw; __i++)
_M_w[__i] |= __x._M_w[__i]; _M_w[__i] |= __x._M_w[__i];
} }
void 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++) for (size_t __i = 0; __i < _Nw; __i++)
_M_w[__i] ^= __x._M_w[__i]; _M_w[__i] ^= __x._M_w[__i];
} }
void void
_M_do_left_shift(size_t __shift); _M_do_left_shift(size_t __shift) _GLIBCXX_NOEXCEPT;
void void
_M_do_right_shift(size_t __shift); _M_do_right_shift(size_t __shift) _GLIBCXX_NOEXCEPT;
void void
_M_do_flip() _M_do_flip() _GLIBCXX_NOEXCEPT
{ {
for (size_t __i = 0; __i < _Nw; __i++) for (size_t __i = 0; __i < _Nw; __i++)
_M_w[__i] = ~_M_w[__i]; _M_w[__i] = ~_M_w[__i];
} }
void void
_M_do_set() _M_do_set() _GLIBCXX_NOEXCEPT
{ {
for (size_t __i = 0; __i < _Nw; __i++) for (size_t __i = 0; __i < _Nw; __i++)
_M_w[__i] = ~static_cast<_WordT>(0); _M_w[__i] = ~static_cast<_WordT>(0);
} }
void void
_M_do_reset() _M_do_reset() _GLIBCXX_NOEXCEPT
{ __builtin_memset(_M_w, 0, _Nw * sizeof(_WordT)); } { __builtin_memset(_M_w, 0, _Nw * sizeof(_WordT)); }
bool 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) for (size_t __i = 0; __i < _Nw; ++__i)
if (_M_w[__i] != __x._M_w[__i]) if (_M_w[__i] != __x._M_w[__i])
...@@ -184,7 +184,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -184,7 +184,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
} }
size_t size_t
_M_are_all_aux() const _M_are_all_aux() const _GLIBCXX_NOEXCEPT
{ {
for (size_t __i = 0; __i < _Nw - 1; __i++) for (size_t __i = 0; __i < _Nw - 1; __i++)
if (_M_w[__i] != ~static_cast<_WordT>(0)) if (_M_w[__i] != ~static_cast<_WordT>(0))
...@@ -194,7 +194,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -194,7 +194,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
} }
bool bool
_M_is_any() const _M_is_any() const _GLIBCXX_NOEXCEPT
{ {
for (size_t __i = 0; __i < _Nw; __i++) for (size_t __i = 0; __i < _Nw; __i++)
if (_M_w[__i] != static_cast<_WordT>(0)) if (_M_w[__i] != static_cast<_WordT>(0))
...@@ -203,7 +203,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -203,7 +203,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
} }
size_t size_t
_M_do_count() const _M_do_count() const _GLIBCXX_NOEXCEPT
{ {
size_t __result = 0; size_t __result = 0;
for (size_t __i = 0; __i < _Nw; __i++) for (size_t __i = 0; __i < _Nw; __i++)
...@@ -221,17 +221,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -221,17 +221,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// find first "on" bit // find first "on" bit
size_t 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" // find the next "on" bit that follows "prev"
size_t 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. // Definitions of non-inline functions from _Base_bitset.
template<size_t _Nw> template<size_t _Nw>
void 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)) if (__builtin_expect(__shift != 0, 1))
{ {
...@@ -257,7 +258,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -257,7 +258,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<size_t _Nw> template<size_t _Nw>
void 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)) if (__builtin_expect(__shift != 0, 1))
{ {
...@@ -311,7 +312,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -311,7 +312,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<size_t _Nw> template<size_t _Nw>
size_t 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++) for (size_t __i = 0; __i < _Nw; __i++)
{ {
...@@ -326,7 +328,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -326,7 +328,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<size_t _Nw> template<size_t _Nw>
size_t 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 // make bound inclusive
++__prev; ++__prev;
...@@ -370,12 +373,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -370,12 +373,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef unsigned long _WordT; typedef unsigned long _WordT;
_WordT _M_w; _WordT _M_w;
_GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_NOEXCEPT
: _M_w(0) : _M_w(0)
{ } { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
constexpr _Base_bitset(unsigned long long __val) constexpr _Base_bitset(unsigned long long __val) noexcept
#else #else
_Base_bitset(unsigned long __val) _Base_bitset(unsigned long __val)
#endif #endif
...@@ -383,103 +386,103 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -383,103 +386,103 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ } { }
static _GLIBCXX_CONSTEXPR size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichword(size_t __pos ) _S_whichword(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
static _GLIBCXX_CONSTEXPR size_t 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__; } { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
static _GLIBCXX_CONSTEXPR size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichbit(size_t __pos ) _S_whichbit(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
static _GLIBCXX_CONSTEXPR _WordT static _GLIBCXX_CONSTEXPR _WordT
_S_maskbit(size_t __pos ) _S_maskbit(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
_WordT& _WordT&
_M_getword(size_t) _M_getword(size_t) _GLIBCXX_NOEXCEPT
{ return _M_w; } { return _M_w; }
_WordT _WordT
_M_getword(size_t) const _M_getword(size_t) const _GLIBCXX_NOEXCEPT
{ return _M_w; } { return _M_w; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
const _WordT* const _WordT*
_M_getdata() const _M_getdata() const noexcept
{ return &_M_w; } { return &_M_w; }
#endif #endif
_WordT& _WordT&
_M_hiword() _M_hiword() _GLIBCXX_NOEXCEPT
{ return _M_w; } { return _M_w; }
_GLIBCXX_CONSTEXPR _WordT _GLIBCXX_CONSTEXPR _WordT
_M_hiword() const _M_hiword() const _GLIBCXX_NOEXCEPT
{ return _M_w; } { return _M_w; }
void void
_M_do_and(const _Base_bitset<1>& __x) _M_do_and(const _Base_bitset<1>& __x) _GLIBCXX_NOEXCEPT
{ _M_w &= __x._M_w; } { _M_w &= __x._M_w; }
void void
_M_do_or(const _Base_bitset<1>& __x) _M_do_or(const _Base_bitset<1>& __x) _GLIBCXX_NOEXCEPT
{ _M_w |= __x._M_w; } { _M_w |= __x._M_w; }
void void
_M_do_xor(const _Base_bitset<1>& __x) _M_do_xor(const _Base_bitset<1>& __x) _GLIBCXX_NOEXCEPT
{ _M_w ^= __x._M_w; } { _M_w ^= __x._M_w; }
void void
_M_do_left_shift(size_t __shift) _M_do_left_shift(size_t __shift) _GLIBCXX_NOEXCEPT
{ _M_w <<= __shift; } { _M_w <<= __shift; }
void void
_M_do_right_shift(size_t __shift) _M_do_right_shift(size_t __shift) _GLIBCXX_NOEXCEPT
{ _M_w >>= __shift; } { _M_w >>= __shift; }
void void
_M_do_flip() _M_do_flip() _GLIBCXX_NOEXCEPT
{ _M_w = ~_M_w; } { _M_w = ~_M_w; }
void void
_M_do_set() _M_do_set() _GLIBCXX_NOEXCEPT
{ _M_w = ~static_cast<_WordT>(0); } { _M_w = ~static_cast<_WordT>(0); }
void void
_M_do_reset() _M_do_reset() _GLIBCXX_NOEXCEPT
{ _M_w = 0; } { _M_w = 0; }
bool 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; } { return _M_w == __x._M_w; }
size_t size_t
_M_are_all_aux() const _M_are_all_aux() const _GLIBCXX_NOEXCEPT
{ return __builtin_popcountl(_M_w); } { return __builtin_popcountl(_M_w); }
bool bool
_M_is_any() const _M_is_any() const _GLIBCXX_NOEXCEPT
{ return _M_w != 0; } { return _M_w != 0; }
size_t size_t
_M_do_count() const _M_do_count() const _GLIBCXX_NOEXCEPT
{ return __builtin_popcountl(_M_w); } { return __builtin_popcountl(_M_w); }
unsigned long unsigned long
_M_do_to_ulong() const _M_do_to_ulong() const _GLIBCXX_NOEXCEPT
{ return _M_w; } { return _M_w; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
unsigned long long unsigned long long
_M_do_to_ullong() const _M_do_to_ullong() const noexcept
{ return _M_w; } { return _M_w; }
#endif #endif
size_t 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) if (_M_w != 0)
return __builtin_ctzl(_M_w); return __builtin_ctzl(_M_w);
...@@ -490,6 +493,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -490,6 +493,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// find the next "on" bit that follows "prev" // find the next "on" bit that follows "prev"
size_t 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
{ {
++__prev; ++__prev;
if (__prev >= ((size_t) _GLIBCXX_BITSET_BITS_PER_WORD)) if (__prev >= ((size_t) _GLIBCXX_BITSET_BITS_PER_WORD))
...@@ -513,30 +517,30 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -513,30 +517,30 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ {
typedef unsigned long _WordT; typedef unsigned long _WordT;
_GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_CONSTEXPR _Base_bitset() _GLIBCXX_NOEXCEPT
{ } { }
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
constexpr _Base_bitset(unsigned long long) constexpr _Base_bitset(unsigned long long) noexcept
#else #else
_Base_bitset(unsigned long) _Base_bitset(unsigned long)
#endif #endif
{ } { }
static _GLIBCXX_CONSTEXPR size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichword(size_t __pos ) _S_whichword(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }
static _GLIBCXX_CONSTEXPR size_t 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__; } { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }
static _GLIBCXX_CONSTEXPR size_t static _GLIBCXX_CONSTEXPR size_t
_S_whichbit(size_t __pos ) _S_whichbit(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }
static _GLIBCXX_CONSTEXPR _WordT static _GLIBCXX_CONSTEXPR _WordT
_S_maskbit(size_t __pos ) _S_maskbit(size_t __pos ) _GLIBCXX_NOEXCEPT
{ return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }
// This would normally give access to the data. The bounds-checking // This would normally give access to the data. The bounds-checking
...@@ -547,89 +551,89 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -547,89 +551,89 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// make an unchecked call; all the memory ugliness is therefore // make an unchecked call; all the memory ugliness is therefore
// localized to this single should-never-get-this-far function. // localized to this single should-never-get-this-far function.
_WordT& _WordT&
_M_getword(size_t) _M_getword(size_t) _GLIBCXX_NOEXCEPT
{ {
__throw_out_of_range(__N("_Base_bitset::_M_getword")); __throw_out_of_range(__N("_Base_bitset::_M_getword"));
return *new _WordT; return *new _WordT;
} }
_WordT _WordT
_M_getword(size_t __pos) const _M_getword(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return 0; } { return 0; }
_GLIBCXX_CONSTEXPR _WordT _GLIBCXX_CONSTEXPR _WordT
_M_hiword() const _M_hiword() const _GLIBCXX_NOEXCEPT
{ return 0; } { return 0; }
void void
_M_do_and(const _Base_bitset<0>&) _M_do_and(const _Base_bitset<0>&) _GLIBCXX_NOEXCEPT
{ } { }
void void
_M_do_or(const _Base_bitset<0>&) _M_do_or(const _Base_bitset<0>&) _GLIBCXX_NOEXCEPT
{ } { }
void void
_M_do_xor(const _Base_bitset<0>&) _M_do_xor(const _Base_bitset<0>&) _GLIBCXX_NOEXCEPT
{ } { }
void void
_M_do_left_shift(size_t) _M_do_left_shift(size_t) _GLIBCXX_NOEXCEPT
{ } { }
void void
_M_do_right_shift(size_t) _M_do_right_shift(size_t) _GLIBCXX_NOEXCEPT
{ } { }
void void
_M_do_flip() _M_do_flip() _GLIBCXX_NOEXCEPT
{ } { }
void void
_M_do_set() _M_do_set() _GLIBCXX_NOEXCEPT
{ } { }
void void
_M_do_reset() _M_do_reset() _GLIBCXX_NOEXCEPT
{ } { }
// Are all empty bitsets equal to each other? Are they equal to // Are all empty bitsets equal to each other? Are they equal to
// themselves? How to compare a thing which has no state? What is // themselves? How to compare a thing which has no state? What is
// the sound of one zero-length bitset clapping? // the sound of one zero-length bitset clapping?
bool bool
_M_is_equal(const _Base_bitset<0>&) const _M_is_equal(const _Base_bitset<0>&) const _GLIBCXX_NOEXCEPT
{ return true; } { return true; }
size_t size_t
_M_are_all_aux() const _M_are_all_aux() const _GLIBCXX_NOEXCEPT
{ return 0; } { return 0; }
bool bool
_M_is_any() const _M_is_any() const _GLIBCXX_NOEXCEPT
{ return false; } { return false; }
size_t size_t
_M_do_count() const _M_do_count() const _GLIBCXX_NOEXCEPT
{ return 0; } { return 0; }
unsigned long unsigned long
_M_do_to_ulong() const _M_do_to_ulong() const _GLIBCXX_NOEXCEPT
{ return 0; } { return 0; }
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
unsigned long long unsigned long long
_M_do_to_ullong() const _M_do_to_ullong() const noexcept
{ return 0; } { return 0; }
#endif #endif
// Normally "not found" is the size, but that could also be // Normally "not found" is the size, but that could also be
// misinterpreted as an index in this corner case. Oh well. // misinterpreted as an index in this corner case. Oh well.
size_t size_t
_M_do_find_first(size_t) const _M_do_find_first(size_t) const _GLIBCXX_NOEXCEPT
{ return 0; } { return 0; }
size_t size_t
_M_do_find_next(size_t, size_t) const _M_do_find_next(size_t, size_t) const _GLIBCXX_NOEXCEPT
{ return 0; } { return 0; }
}; };
...@@ -641,7 +645,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -641,7 +645,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef unsigned long _WordT; typedef unsigned long _WordT;
static void static void
_S_do_sanitize(_WordT& __val) _S_do_sanitize(_WordT& __val) _GLIBCXX_NOEXCEPT
{ __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); } { __val &= ~((~static_cast<_WordT>(0)) << _Extrabits); }
}; };
...@@ -651,7 +655,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -651,7 +655,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef unsigned long _WordT; typedef unsigned long _WordT;
static void static void
_S_do_sanitize(_WordT) { } _S_do_sanitize(_WordT) _GLIBCXX_NOEXCEPT { }
}; };
/** /**
...@@ -727,7 +731,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -727,7 +731,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef unsigned long _WordT; typedef unsigned long _WordT;
void void
_M_do_sanitize() _M_do_sanitize() _GLIBCXX_NOEXCEPT
{ {
typedef _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD> __sanitize_type; typedef _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD> __sanitize_type;
__sanitize_type::_S_do_sanitize(this->_M_hiword()); __sanitize_type::_S_do_sanitize(this->_M_hiword());
...@@ -761,18 +765,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -761,18 +765,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
reference(); reference();
public: public:
reference(bitset& __b, size_t __pos) reference(bitset& __b, size_t __pos) _GLIBCXX_NOEXCEPT
{ {
_M_wp = &__b._M_getword(__pos); _M_wp = &__b._M_getword(__pos);
_M_bpos = _Base::_S_whichbit(__pos); _M_bpos = _Base::_S_whichbit(__pos);
} }
~reference() ~reference() _GLIBCXX_NOEXCEPT
{ } { }
// For b[i] = __x; // For b[i] = __x;
reference& reference&
operator=(bool __x) operator=(bool __x) _GLIBCXX_NOEXCEPT
{ {
if (__x) if (__x)
*_M_wp |= _Base::_S_maskbit(_M_bpos); *_M_wp |= _Base::_S_maskbit(_M_bpos);
...@@ -783,7 +787,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -783,7 +787,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// For b[i] = b[__j]; // For b[i] = b[__j];
reference& reference&
operator=(const reference& __j) operator=(const reference& __j) _GLIBCXX_NOEXCEPT
{ {
if ((*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos))) if ((*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos)))
*_M_wp |= _Base::_S_maskbit(_M_bpos); *_M_wp |= _Base::_S_maskbit(_M_bpos);
...@@ -794,16 +798,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -794,16 +798,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// Flips the bit // Flips the bit
bool bool
operator~() const operator~() const _GLIBCXX_NOEXCEPT
{ return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; } { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; }
// For __x = b[i]; // For __x = b[i];
operator bool() const operator bool() const _GLIBCXX_NOEXCEPT
{ return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; } { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; }
// For b[i].flip(); // For b[i].flip();
reference& reference&
flip() flip() _GLIBCXX_NOEXCEPT
{ {
*_M_wp ^= _Base::_S_maskbit(_M_bpos); *_M_wp ^= _Base::_S_maskbit(_M_bpos);
return *this; return *this;
...@@ -813,12 +817,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -813,12 +817,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// 23.3.5.1 constructors: // 23.3.5.1 constructors:
/// All bits set to zero. /// 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). /// Initial bits bitwise-copied from a single word (others set to zero).
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
constexpr bitset(unsigned long long __val) constexpr bitset(unsigned long long __val) noexcept
: _Base(__val) { } : _Base(__val) { }
#else #else
bitset(unsigned long __val) bitset(unsigned long __val)
...@@ -921,21 +925,21 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -921,21 +925,21 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* These should be self-explanatory. * These should be self-explanatory.
*/ */
bitset<_Nb>& bitset<_Nb>&
operator&=(const bitset<_Nb>& __rhs) operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{ {
this->_M_do_and(__rhs); this->_M_do_and(__rhs);
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator|=(const bitset<_Nb>& __rhs) operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{ {
this->_M_do_or(__rhs); this->_M_do_or(__rhs);
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator^=(const bitset<_Nb>& __rhs) operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT
{ {
this->_M_do_xor(__rhs); this->_M_do_xor(__rhs);
return *this; return *this;
...@@ -950,7 +954,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -950,7 +954,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* These should be self-explanatory. * These should be self-explanatory.
*/ */
bitset<_Nb>& bitset<_Nb>&
operator<<=(size_t __position) operator<<=(size_t __position) _GLIBCXX_NOEXCEPT
{ {
if (__builtin_expect(__position < _Nb, 1)) if (__builtin_expect(__position < _Nb, 1))
{ {
...@@ -963,7 +967,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -963,7 +967,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
} }
bitset<_Nb>& bitset<_Nb>&
operator>>=(size_t __position) operator>>=(size_t __position) _GLIBCXX_NOEXCEPT
{ {
if (__builtin_expect(__position < _Nb, 1)) if (__builtin_expect(__position < _Nb, 1))
{ {
...@@ -983,14 +987,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -983,14 +987,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @ingroup SGIextensions * @ingroup SGIextensions
*/ */
bitset<_Nb>& bitset<_Nb>&
_Unchecked_set(size_t __pos) _Unchecked_set(size_t __pos) _GLIBCXX_NOEXCEPT
{ {
this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); this->_M_getword(__pos) |= _Base::_S_maskbit(__pos);
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
_Unchecked_set(size_t __pos, int __val) _Unchecked_set(size_t __pos, int __val) _GLIBCXX_NOEXCEPT
{ {
if (__val) if (__val)
this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); this->_M_getword(__pos) |= _Base::_S_maskbit(__pos);
...@@ -1000,21 +1004,21 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1000,21 +1004,21 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
} }
bitset<_Nb>& bitset<_Nb>&
_Unchecked_reset(size_t __pos) _Unchecked_reset(size_t __pos) _GLIBCXX_NOEXCEPT
{ {
this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos);
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
_Unchecked_flip(size_t __pos) _Unchecked_flip(size_t __pos) _GLIBCXX_NOEXCEPT
{ {
this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos); this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos);
return *this; return *this;
} }
bool bool
_Unchecked_test(size_t __pos) const _Unchecked_test(size_t __pos) const _GLIBCXX_NOEXCEPT
{ return ((this->_M_getword(__pos) & _Base::_S_maskbit(__pos)) { return ((this->_M_getword(__pos) & _Base::_S_maskbit(__pos))
!= static_cast<_WordT>(0)); } != static_cast<_WordT>(0)); }
//@} //@}
...@@ -1024,7 +1028,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1024,7 +1028,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @brief Sets every bit to true. * @brief Sets every bit to true.
*/ */
bitset<_Nb>& bitset<_Nb>&
set() set() _GLIBCXX_NOEXCEPT
{ {
this->_M_do_set(); this->_M_do_set();
this->_M_do_sanitize(); this->_M_do_sanitize();
...@@ -1049,7 +1053,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1049,7 +1053,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @brief Sets every bit to false. * @brief Sets every bit to false.
*/ */
bitset<_Nb>& bitset<_Nb>&
reset() reset() _GLIBCXX_NOEXCEPT
{ {
this->_M_do_reset(); this->_M_do_reset();
return *this; return *this;
...@@ -1074,7 +1078,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1074,7 +1078,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @brief Toggles every bit to its opposite value. * @brief Toggles every bit to its opposite value.
*/ */
bitset<_Nb>& bitset<_Nb>&
flip() flip() _GLIBCXX_NOEXCEPT
{ {
this->_M_do_flip(); this->_M_do_flip();
this->_M_do_sanitize(); this->_M_do_sanitize();
...@@ -1096,7 +1100,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1096,7 +1100,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/// See the no-argument flip(). /// See the no-argument flip().
bitset<_Nb> bitset<_Nb>
operator~() const operator~() const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(*this).flip(); } { return bitset<_Nb>(*this).flip(); }
//@{ //@{
...@@ -1247,22 +1251,22 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1247,22 +1251,22 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/// Returns the number of bits which are set. /// Returns the number of bits which are set.
size_t size_t
count() const count() const _GLIBCXX_NOEXCEPT
{ return this->_M_do_count(); } { return this->_M_do_count(); }
/// Returns the total number of bits. /// Returns the total number of bits.
_GLIBCXX_CONSTEXPR size_t _GLIBCXX_CONSTEXPR size_t
size() const size() const _GLIBCXX_NOEXCEPT
{ return _Nb; } { return _Nb; }
//@{ //@{
/// These comparisons for equality/inequality are, well, @e bitwise. /// These comparisons for equality/inequality are, well, @e bitwise.
bool bool
operator==(const bitset<_Nb>& __rhs) const operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return this->_M_is_equal(__rhs); } { return this->_M_is_equal(__rhs); }
bool bool
operator!=(const bitset<_Nb>& __rhs) const operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT
{ return !this->_M_is_equal(__rhs); } { return !this->_M_is_equal(__rhs); }
//@} //@}
...@@ -1287,7 +1291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1287,7 +1291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @return True if all the bits are set. * @return True if all the bits are set.
*/ */
bool bool
all() const all() const _GLIBCXX_NOEXCEPT
{ return this->_M_are_all_aux() == _Nb; } { return this->_M_are_all_aux() == _Nb; }
/** /**
...@@ -1295,7 +1299,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1295,7 +1299,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @return True if at least one bit is set. * @return True if at least one bit is set.
*/ */
bool bool
any() const any() const _GLIBCXX_NOEXCEPT
{ return this->_M_is_any(); } { return this->_M_is_any(); }
/** /**
...@@ -1303,17 +1307,17 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1303,17 +1307,17 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @return True if none of the bits are set. * @return True if none of the bits are set.
*/ */
bool bool
none() const none() const _GLIBCXX_NOEXCEPT
{ return !this->_M_is_any(); } { return !this->_M_is_any(); }
//@{ //@{
/// Self-explanatory. /// Self-explanatory.
bitset<_Nb> bitset<_Nb>
operator<<(size_t __position) const operator<<(size_t __position) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(*this) <<= __position; } { return bitset<_Nb>(*this) <<= __position; }
bitset<_Nb> bitset<_Nb>
operator>>(size_t __position) const operator>>(size_t __position) const _GLIBCXX_NOEXCEPT
{ return bitset<_Nb>(*this) >>= __position; } { return bitset<_Nb>(*this) >>= __position; }
//@} //@}
...@@ -1324,7 +1328,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1324,7 +1328,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @sa _Find_next * @sa _Find_next
*/ */
size_t size_t
_Find_first() const _Find_first() const _GLIBCXX_NOEXCEPT
{ return this->_M_do_find_first(_Nb); } { return this->_M_do_find_first(_Nb); }
/** /**
...@@ -1335,7 +1339,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1335,7 +1339,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @sa _Find_first * @sa _Find_first
*/ */
size_t size_t
_Find_next(size_t __prev ) const _Find_next(size_t __prev ) const _GLIBCXX_NOEXCEPT
{ return this->_M_do_find_next(__prev, _Nb); } { return this->_M_do_find_next(__prev, _Nb); }
}; };
...@@ -1386,7 +1390,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1386,7 +1390,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
*/ */
template<size_t _Nb> template<size_t _Nb>
inline bitset<_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); bitset<_Nb> __result(__x);
__result &= __y; __result &= __y;
...@@ -1395,7 +1399,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1395,7 +1399,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<size_t _Nb> template<size_t _Nb>
inline bitset<_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); bitset<_Nb> __result(__x);
__result |= __y; __result |= __y;
...@@ -1404,7 +1408,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER ...@@ -1404,7 +1408,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template <size_t _Nb> template <size_t _Nb>
inline bitset<_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); bitset<_Nb> __result(__x);
__result ^= __y; __result ^= __y;
......
// std::initializer_list support -*- C++ -*- // std::initializer_list support -*- C++ -*-
// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. // Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
// //
// This file is part of GCC. // This file is part of GCC.
// //
...@@ -61,19 +61,20 @@ namespace std ...@@ -61,19 +61,20 @@ namespace std
: _M_array(__a), _M_len(__l) { } : _M_array(__a), _M_len(__l) { }
public: public:
constexpr initializer_list() : _M_array(0), _M_len(0) { } constexpr initializer_list() noexcept
: _M_array(0), _M_len(0) { }
// Number of elements. // Number of elements.
constexpr size_type constexpr size_type
size() { return _M_len; } size() const noexcept { return _M_len; }
// First element. // First element.
constexpr const_iterator constexpr const_iterator
begin() { return _M_array; } begin() const noexcept { return _M_array; }
// One past the last element. // One past the last element.
constexpr const_iterator constexpr const_iterator
end() { return begin() + size(); } end() const noexcept { return begin() + size(); }
}; };
/** /**
...@@ -83,7 +84,7 @@ namespace std ...@@ -83,7 +84,7 @@ namespace std
*/ */
template<class _Tp> template<class _Tp>
constexpr const _Tp* constexpr const _Tp*
begin(initializer_list<_Tp> __ils) begin(initializer_list<_Tp> __ils) noexcept
{ return __ils.begin(); } { return __ils.begin(); }
/** /**
...@@ -93,7 +94,7 @@ namespace std ...@@ -93,7 +94,7 @@ namespace std
*/ */
template<class _Tp> template<class _Tp>
constexpr const _Tp* constexpr const _Tp*
end(initializer_list<_Tp> __ils) end(initializer_list<_Tp> __ils) noexcept
{ return __ils.end(); } { return __ils.end(); }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment