ReactOS  0.4.14-dev-49-gfb4591c
_bitset.h File Reference
#include <stl/_algobase.h>
#include <stl/_alloc.h>
#include <stl/_iterator.h>
#include <stl/_uninitialized.h>
#include <stl/_range_errors.h>
#include <stl/_string.h>
#include <stl/_iosfwd.h>
#include <stl/_bitset.c>
Include dependency graph for _bitset.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  _Bs_G
 
struct  _Base_bitset< _Nw >
 
struct  _Base_bitset< 1UL >
 
struct  _Sanitize< _Extrabits >
 
struct  _Sanitize< 0UL >
 
class  bitset< _Nb >
 
struct  bitset< _Nb >::reference
 

Macros

#define __BITS_PER_WORD   (CHAR_BIT*sizeof(unsigned long))
 
#define __BITSET_WORDS(__n)   ((__n + __BITS_PER_WORD - 1)/__BITS_PER_WORD)
 

Functions

template<size_t _Nb>
bitset< _Nb > _STLP_CALL operator & (const bitset< _Nb > &__x, const bitset< _Nb > &__y)
 
template<size_t _Nb>
bitset< _Nb > _STLP_CALL operator| (const bitset< _Nb > &__x, const bitset< _Nb > &__y)
 
template<size_t _Nb>
bitset< _Nb > _STLP_CALL operator^ (const bitset< _Nb > &__x, const bitset< _Nb > &__y)
 
template<class _CharT , class _Traits , size_t _Nb>
_STLP_END_NAMESPACE _STLP_BEGIN_NAMESPACE basic_istream< _CharT, _Traits > &_STLP_CALL operator>> (basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
 
template<class _CharT , class _Traits , size_t _Nb>
basic_ostream< _CharT, _Traits > &_STLP_CALL operator<< (basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
 

Macro Definition Documentation

◆ __BITS_PER_WORD

#define __BITS_PER_WORD   (CHAR_BIT*sizeof(unsigned long))

Definition at line 62 of file _bitset.h.

◆ __BITSET_WORDS

#define __BITSET_WORDS (   __n)    ((__n + __BITS_PER_WORD - 1)/__BITS_PER_WORD)

Definition at line 63 of file _bitset.h.

Function Documentation

◆ operator &()

template<size_t _Nb>
bitset<_Nb> _STLP_CALL operator & ( const bitset< _Nb > &  __x,
const bitset< _Nb > &  __y 
)
inline

Definition at line 704 of file _bitset.h.

705  {
706  bitset<_Nb> __result(__x);
707  __result &= __y;
708  return __result;
709 }

◆ operator<<()

template<class _CharT , class _Traits , size_t _Nb>
basic_ostream<_CharT, _Traits>& _STLP_CALL operator<< ( basic_ostream< _CharT, _Traits > &  __os,
const bitset< _Nb > &  __x 
)

Definition at line 219 of file _bitset.c.

220  {
222  __x._M_copy_to_string(__tmp);
223  return __os << __tmp;
224 }
void _M_copy_to_string(string &__s) const
Definition: _bitset.h:656

◆ operator>>()

template<class _CharT , class _Traits , size_t _Nb>
_STLP_END_NAMESPACE _STLP_BEGIN_NAMESPACE basic_istream<_CharT, _Traits>& _STLP_CALL operator>> ( basic_istream< _CharT, _Traits > &  __is,
bitset< _Nb > &  __x 
)

Definition at line 179 of file _bitset.c.

179  {
181  __tmp.reserve(_Nb);
182 
183  // Skip whitespace
184  typename basic_istream<_CharT, _Traits>::sentry __sentry(__is);
185  if (__sentry) {
186  basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf();
187  for (size_t __i = 0; __i < _Nb; ++__i) {
188  static typename _Traits::int_type __eof = _Traits::eof();
189 
190  typename _Traits::int_type __c1 = __buf->sbumpc();
191  if (_Traits::eq_int_type(__c1, __eof)) {
192  __is.setstate(ios_base::eofbit);
193  break;
194  }
195  else {
196  typename _Traits::char_type __c2 = _Traits::to_char_type(__c1);
197  char __c = __is.narrow(__c2, '*');
198 
199  if (__c == '0' || __c == '1')
200  __tmp.push_back(__c);
201  else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) {
202  __is.setstate(ios_base::failbit);
203  break;
204  }
205  }
206  }
207 
208  if (__tmp.empty())
209  __is.setstate(ios_base::failbit);
210  else
211  __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb);
212  }
213 
214  return __is;
215 }
basic_streambuf< _CharT, _Traits > * rdbuf() const
Definition: _ios.h:72
#define __STATIC_CAST(__x, __y)
Definition: features.h:585
#define __c
Definition: schilyio.h:209
char narrow(_CharT, char) const
Definition: _ios.h:145
int_type sbumpc()
Definition: _streambuf.h:227
bool empty() const
Definition: _string.h:428
void push_back(_CharT __c)
Definition: _string.h:534
void setstate(iostate __state)
Definition: _ios.h:95
_Check_return_ _CRTIMP int __cdecl __cdecl eof(_In_ int _FileHandle)
void _M_copy_from_string(const string &__s, size_t __pos, size_t __n)
Definition: _bitset.h:635
int_type sputbackc(char_type __c)
Definition: _streambuf.h:241
void reserve(size_type=0)
Definition: _string.c:158

◆ operator^()

template<size_t _Nb>
bitset<_Nb> _STLP_CALL operator^ ( const bitset< _Nb > &  __x,
const bitset< _Nb > &  __y 
)
inline

Definition at line 723 of file _bitset.h.

724  {
725  bitset<_Nb> __result(__x);
726  __result ^= __y;
727  return __result;
728 }

◆ operator|()

template<size_t _Nb>
bitset<_Nb> _STLP_CALL operator| ( const bitset< _Nb > &  __x,
const bitset< _Nb > &  __y 
)
inline

Definition at line 714 of file _bitset.h.

715  {
716  bitset<_Nb> __result(__x);
717  __result |= __y;
718  return __result;
719 }