diff options
Diffstat (limited to 'contrib/libc++/include/bitset')
-rw-r--r-- | contrib/libc++/include/bitset | 124 |
1 files changed, 83 insertions, 41 deletions
diff --git a/contrib/libc++/include/bitset b/contrib/libc++/include/bitset index 8c278cc724f1..87d7afca5a73 100644 --- a/contrib/libc++/include/bitset +++ b/contrib/libc++/include/bitset @@ -168,7 +168,9 @@ protected: typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, true> const_iterator; + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT @@ -180,8 +182,11 @@ protected: _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT {return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} + _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset& __v) _NOEXCEPT; void flip() _NOEXCEPT; @@ -192,22 +197,27 @@ protected: bool all() const _NOEXCEPT; bool any() const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT; private: #ifdef _LIBCPP_HAS_NO_CONSTEXPR void __init(unsigned long long __v, false_type) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY void __init(unsigned long long __v, true_type) _NOEXCEPT; #endif // _LIBCPP_HAS_NO_CONSTEXPR unsigned long to_ulong(false_type) const; + _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong(true_type) const; unsigned long long to_ullong(false_type) const; + _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong(true_type) const; + _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong(true_type, false_type) const; unsigned long long to_ullong(true_type, true_type) const; }; template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset() _NOEXCEPT #ifndef _LIBCPP_HAS_NO_CONSTEXPR @@ -245,7 +255,7 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT #endif // _LIBCPP_HAS_NO_CONSTEXPR template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT #ifndef _LIBCPP_HAS_NO_CONSTEXPR @@ -264,7 +274,7 @@ __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT { @@ -273,7 +283,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT { @@ -282,7 +292,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT { @@ -325,7 +335,7 @@ __bitset<_N_words, _Size>::to_ulong(false_type) const } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long __bitset<_N_words, _Size>::to_ulong(true_type) const { @@ -348,7 +358,7 @@ __bitset<_N_words, _Size>::to_ullong(false_type) const } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long long __bitset<_N_words, _Size>::to_ullong(true_type) const { @@ -356,7 +366,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type) const } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long long __bitset<_N_words, _Size>::to_ullong(true_type, false_type) const { @@ -414,7 +424,7 @@ __bitset<_N_words, _Size>::any() const _NOEXCEPT } template <size_t _N_words, size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline size_t __bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT { @@ -450,7 +460,9 @@ protected: typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, true> const_iterator; + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT @@ -462,23 +474,32 @@ protected: _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT {return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} + _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset& __v) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const; + _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const; + _LIBCPP_INLINE_VISIBILITY bool all() const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bool any() const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT; }; template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset() _NOEXCEPT : __first_(0) @@ -486,7 +507,7 @@ __bitset<1, _Size>::__bitset() _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT : __first_(static_cast<__storage_type>(__v)) @@ -494,7 +515,7 @@ __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT { @@ -502,7 +523,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT { @@ -510,7 +531,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT { @@ -518,7 +539,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline void __bitset<1, _Size>::flip() _NOEXCEPT { @@ -528,7 +549,7 @@ __bitset<1, _Size>::flip() _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long __bitset<1, _Size>::to_ulong() const { @@ -536,7 +557,7 @@ __bitset<1, _Size>::to_ulong() const } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long long __bitset<1, _Size>::to_ullong() const { @@ -544,7 +565,7 @@ __bitset<1, _Size>::to_ullong() const } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bool __bitset<1, _Size>::all() const _NOEXCEPT { @@ -553,7 +574,7 @@ __bitset<1, _Size>::all() const _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bool __bitset<1, _Size>::any() const _NOEXCEPT { @@ -562,7 +583,7 @@ __bitset<1, _Size>::any() const _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline size_t __bitset<1, _Size>::__hash_code() const _NOEXCEPT { @@ -593,7 +614,9 @@ protected: typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, true> const_iterator; + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT @@ -620,13 +643,13 @@ protected: _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;} }; -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset() _NOEXCEPT { } -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT { @@ -663,16 +686,23 @@ public: _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')); // 23.3.5.2 bitset operations: + _LIBCPP_INLINE_VISIBILITY bitset& operator&=(const bitset& __rhs) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bitset& operator|=(const bitset& __rhs) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bitset& operator^=(const bitset& __rhs) _NOEXCEPT; bitset& operator<<=(size_t __pos) _NOEXCEPT; bitset& operator>>=(size_t __pos) _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bitset& set() _NOEXCEPT; bitset& set(size_t __pos, bool __val = true); + _LIBCPP_INLINE_VISIBILITY bitset& reset() _NOEXCEPT; bitset& reset(size_t __pos); + _LIBCPP_INLINE_VISIBILITY bitset operator~() const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bitset& flip() _NOEXCEPT; bitset& flip(size_t __pos); @@ -680,28 +710,40 @@ public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference operator[](size_t __p) const {return base::__make_ref(__p);} _LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);} + _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const; + _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const; template <class _CharT, class _Traits, class _Allocator> basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; template <class _CharT, class _Traits> + _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; template <class _CharT> + _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) const; + _LIBCPP_INLINE_VISIBILITY basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0', char __one = '1') const; + _LIBCPP_INLINE_VISIBILITY size_t count() const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;} + _LIBCPP_INLINE_VISIBILITY bool operator==(const bitset& __rhs) const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bool operator!=(const bitset& __rhs) const _NOEXCEPT; bool test(size_t __pos) const; + _LIBCPP_INLINE_VISIBILITY bool all() const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bool any() const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();} + _LIBCPP_INLINE_VISIBILITY bitset operator<<(size_t __pos) const _NOEXCEPT; + _LIBCPP_INLINE_VISIBILITY bitset operator>>(size_t __pos) const _NOEXCEPT; private: @@ -774,7 +816,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str, } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size>& bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT { @@ -783,7 +825,7 @@ bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size>& bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT { @@ -792,7 +834,7 @@ bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size>& bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT { @@ -821,7 +863,7 @@ bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size>& bitset<_Size>::set() _NOEXCEPT { @@ -844,7 +886,7 @@ bitset<_Size>::set(size_t __pos, bool __val) } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size>& bitset<_Size>::reset() _NOEXCEPT { @@ -867,7 +909,7 @@ bitset<_Size>::reset(size_t __pos) } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size> bitset<_Size>::operator~() const _NOEXCEPT { @@ -877,7 +919,7 @@ bitset<_Size>::operator~() const _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size>& bitset<_Size>::flip() _NOEXCEPT { @@ -901,7 +943,7 @@ bitset<_Size>::flip(size_t __pos) } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long bitset<_Size>::to_ulong() const { @@ -909,7 +951,7 @@ bitset<_Size>::to_ulong() const } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline unsigned long long bitset<_Size>::to_ullong() const { @@ -932,7 +974,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const template <size_t _Size> template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_string<_CharT, _Traits, allocator<_CharT> > bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { @@ -941,7 +983,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const template <size_t _Size> template <class _CharT> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > bitset<_Size>::to_string(_CharT __zero, _CharT __one) const { @@ -949,7 +991,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_string<char, char_traits<char>, allocator<char> > bitset<_Size>::to_string(char __zero, char __one) const { @@ -957,7 +999,7 @@ bitset<_Size>::to_string(char __zero, char __one) const } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline size_t bitset<_Size>::count() const _NOEXCEPT { @@ -965,7 +1007,7 @@ bitset<_Size>::count() const _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bool bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT { @@ -973,7 +1015,7 @@ bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bool bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT { @@ -994,7 +1036,7 @@ bitset<_Size>::test(size_t __pos) const } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bool bitset<_Size>::all() const _NOEXCEPT { @@ -1002,7 +1044,7 @@ bitset<_Size>::all() const _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bool bitset<_Size>::any() const _NOEXCEPT { @@ -1010,7 +1052,7 @@ bitset<_Size>::any() const _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size> bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT { @@ -1020,7 +1062,7 @@ bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT } template <size_t _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline bitset<_Size> bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT { |