STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
bitset< _Bits > Class Template Reference

Public Types

enum  : size_t { _EEN_BITS = _Bits }
 
typedef _If< _Bits<=32, _Uint32t, _ULonglong >::type _Ty;typedef bool element_type;class reference{friend class bitset< _Bits >;public:~reference() _NOEXCEPT{}reference &operator=(bool _Val) _NOEXCEPT{_Pbitset-> set(_Mypos, _Val)
 

Public Member Functions

referenceoperator= (const reference &_Bitref) _NOEXCEPT
 
referenceflip () _NOEXCEPT
 
bool operator~ () const _NOEXCEPT
 
 operator bool () const _NOEXCEPT
 

Public Attributes

returnthis
 

Private Types

enum  : ptrdiff_t { _Bitsperword = (ptrdiff_t)(CHAR_BIT * sizeof (_Ty)), _Words }
 

Private Member Functions

 reference () _NOEXCEPT
 
 reference (bitset< _Bits > &_Bitset, size_t _Pos)
 
bool at (size_t _Pos) const
 
reference at (size_t _Pos)
 
bool operator[] (size_t _Pos) const
 
reference operator[] (size_t _Pos)
 
 bitset () _NOEXCEPT
 
 bitset (_ULonglong _Val) _NOEXCEPT
 
template<class _Elem , class _Tr , class _Alloc >
 bitset (const basic_string< _Elem, _Tr, _Alloc > &_Str, _BITSET_SIZE_TYPE _Pos=0, _BITSET_SIZE_TYPE _Count=basic_string< _Elem, _Tr, _Alloc >::npos, _Elem _E0=(_Elem)'0', _Elem _E1=(_Elem)'1')
 
template<class _Elem >
 bitset (const _Elem *_Ptr, typename basic_string< _Elem >::size_type _Count=basic_string< _Elem >::npos, _Elem _E0=(_Elem)'0', _Elem _E1=(_Elem)'1')
 
template<class _Elem , class _Tr , class _Alloc >
void _Construct (const basic_string< _Elem, _Tr, _Alloc > &_Str, _BITSET_SIZE_TYPE _Pos, _BITSET_SIZE_TYPE _Count, _Elem _E0, _Elem _E1)
 
bitset< _Bits > & operator&= (const bitset< _Bits > &_Right) _NOEXCEPT
 
bitset< _Bits > & operator|= (const bitset< _Bits > &_Right) _NOEXCEPT
 
bitset< _Bits > & operator^= (const bitset< _Bits > &_Right) _NOEXCEPT
 
bitset< _Bits > & operator<<= (size_t _Pos) _NOEXCEPT
 
bitset< _Bits > & operator>>= (size_t _Pos) _NOEXCEPT
 
bitset< _Bits > & set () _NOEXCEPT
 
bitset< _Bits > & set (size_t _Pos, bool _Val=true)
 
bitset< _Bits > & reset () _NOEXCEPT
 
bitset< _Bits > & reset (size_t _Pos)
 
bitset< _Bits > operator~ () const _NOEXCEPT
 
bitset< _Bits > & flip () _NOEXCEPT
 
bitset< _Bits > & flip (size_t _Pos)
 
unsigned long to_ulong () const _NOEXCEPT
 
_ULonglong to_ullong () const _NOEXCEPT
 
template<class _Elem , class _Tr , class _Alloc >
basic_string< _Elem, _Tr, _Alloc > to_string (_Elem _E0=(_Elem)'0', _Elem _E1=(_Elem)'1') const
 
template<class _Elem , class _Tr >
basic_string< _Elem, _Tr, allocator< _Elem > > to_string (_Elem _E0=(_Elem)'0', _Elem _E1=(_Elem)'1') const
 
template<class _Elem >
basic_string< _Elem, char_traits< _Elem >, allocator< _Elem > > to_string (_Elem _E0=(_Elem)'0', _Elem _E1=(_Elem)'1') const
 
string to_string (char _E0= '0', char _E1= '1') const
 
size_t count () const _NOEXCEPT
 
size_t size () const _NOEXCEPT
 
size_t hash () const
 
bool operator== (const bitset< _Bits > &_Right) const _NOEXCEPT
 
bool operator!= (const bitset< _Bits > &_Right) const _NOEXCEPT
 
bool test (size_t _Pos) const
 
bool any () const _NOEXCEPT
 
bool none () const _NOEXCEPT
 
bool all () const _NOEXCEPT
 
bitset< _Bits > operator<< (size_t _Pos) const _NOEXCEPT
 
bitset< _Bits > operator>> (size_t _Pos) const _NOEXCEPT
 
_Ty _Getword (size_t _Wpos) const
 
void _Tidy (_Ty _Wordval=0)
 
void _Trim ()
 
void _Trim_if (true_type)
 
void _Trim_if (false_type)
 
 __declspec (noreturn) void _Xinv() const
 
 __declspec (noreturn) void _Xoflo() const
 
 __declspec (noreturn) void _Xran() const
 

Private Attributes

bitset< _Bits > * _Pbitset
 
size_t _Mypos
 
_Ty _Array [_Words+1]
 

Member Typedef Documentation

template<size_t _Bits>
typedef _If<_Bits <= 32, _Uint32t, _ULonglong>::type _Ty; typedef bool element_type; class reference { friend class bitset<_Bits>; public: ~reference() _NOEXCEPT { } reference& operator=(bool _Val) _NOEXCEPT { _Pbitset-> bitset< _Bits >::set(_Mypos, _Val)

Member Enumeration Documentation

template<size_t _Bits>
anonymous enum : size_t
Enumerator
_EEN_BITS 
24 : size_t {_EEN_BITS = _Bits}; // helper for expression evaluator
Definition: bitset:24
template<size_t _Bits>
anonymous enum : ptrdiff_t
private
Enumerator
_Bitsperword 
_Words 
453  : ptrdiff_t
454 
455  { // parameters for packing bits into words
456  _Bitsperword = (ptrdiff_t)(CHAR_BIT * sizeof (_Ty)),
457  _Words = (ptrdiff_t)(_Bits == 0
458  ? 0 : (_Bits - 1) / _Bitsperword)}; // NB: number of words - 1
Definition: bitset:457
#define CHAR_BIT
Definition: limits.h:22
_W64 int ptrdiff_t
Definition: crtdefs.h:530
Definition: bitset:456

Constructor & Destructor Documentation

template<size_t _Bits>
bitset< _Bits >::bitset ( )
inlineprivate
112  { // construct with all false values
113  _Tidy();
114  }
void _Tidy(_Ty _Wordval=0)
Definition: bitset:460
template<size_t _Bits>
bitset< _Bits >::bitset ( _ULonglong  _Val)
inlineprivate
119  { // construct from bits in unsigned long
120  _Tidy();
121  for (size_t _Pos = 0; _Val != 0 && _Pos < _Bits; _Val >>= 1, ++_Pos)
122  if (_Val & 1)
123  set(_Pos);
124  }
bitset< _Bits > & set() _NOEXCEPT
Definition: bitset:239
void _Tidy(_Ty _Wordval=0)
Definition: bitset:460
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<size_t _Bits>
template<class _Elem , class _Tr , class _Alloc >
bitset< _Bits >::bitset ( const basic_string< _Elem, _Tr, _Alloc > &  _Str,
_BITSET_SIZE_TYPE  _Pos = 0,
_BITSET_SIZE_TYPE  _Count = basic_string<_Elem, _Tr, _Alloc>::npos,
_Elem  _E0 = (_Elem)'0',
_Elem  _E1 = (_Elem)'1' 
)
inlineexplicitprivate
137  { // construct from [_Pos, _Pos + _Count) elements in string
138  _Construct(_Str, _Pos, _Count, _E0, _E1);
139  }
void _Construct(const basic_string< _Elem, _Tr, _Alloc > &_Str, _BITSET_SIZE_TYPE _Pos, _BITSET_SIZE_TYPE _Count, _Elem _E0, _Elem _E1)
Definition: bitset:158
_Diff _Count
Definition: algorithm:1941
template<size_t _Bits>
template<class _Elem >
bitset< _Bits >::bitset ( const _Elem *  _Ptr,
typename basic_string< _Elem >::size_type  _Count = basic_string<_Elem>::npos,
_Elem  _E0 = (_Elem)'0',
_Elem  _E1 = (_Elem)'1' 
)
inlineexplicitprivate
147  { // initialize from NTBS
148  _Construct(
150  ? basic_string<_Elem>(_Ptr)
151  : basic_string<_Elem>(_Ptr, _Count),
152  0, _Count, _E0, _E1);
153  }
void _Construct(const basic_string< _Elem, _Tr, _Alloc > &_Str, _BITSET_SIZE_TYPE _Pos, _BITSET_SIZE_TYPE _Count, _Elem _E0, _Elem _E1)
Definition: bitset:158
_Diff _Count
Definition: algorithm:1941
Definition: xstring:21

Member Function Documentation

template<size_t _Bits>
bitset< _Bits >::__declspec ( noreturn  ) const
inlineprivate
483  { // report invalid string element in bitset conversion
484  _Xinvalid_argument("invalid bitset<N> char");
485  }
template<size_t _Bits>
bitset< _Bits >::__declspec ( noreturn  ) const
inlineprivate
488  { // report converted value too big to represent
489  _Xoverflow_error("bitset<N> overflow");
490  }
template<size_t _Bits>
bitset< _Bits >::__declspec ( noreturn  ) const
inlineprivate
493  { // report bit index out of range
494  _Xout_of_range("invalid bitset<N> position");
495  }
template<size_t _Bits>
template<class _Elem , class _Tr , class _Alloc >
void bitset< _Bits >::_Construct ( const basic_string< _Elem, _Tr, _Alloc > &  _Str,
_BITSET_SIZE_TYPE  _Pos,
_BITSET_SIZE_TYPE  _Count,
_Elem  _E0,
_Elem  _E1 
)
inlineprivate
164  { // initialize from [_Pos, _Pos + _Count) elements in string
166  if (_Str.size() < _Pos)
167  _Xran(); // _Pos off end
168  if (_Str.size() - _Pos < _Count)
169  _Count = _Str.size() - _Pos; // trim _Count to size
170  if (_Bits < _Count)
171  _Count = _Bits; // trim _Count to length of bitset
172  _Tidy();
173 
174  for (_Pos += _Count, _Num = 0; _Num < _Count; ++_Num)
175  if (_Str[--_Pos] == _E1)
176  set(_Num);
177  else if (_Str[_Pos] != _E0)
178  _Xinv();
179  }
bitset< _Bits > & set() _NOEXCEPT
Definition: bitset:239
void _Tidy(_Ty _Wordval=0)
Definition: bitset:460
size_type size() const _NOEXCEPT
Definition: xstring:1752
_Diff _Count
Definition: algorithm:1941
_Mybase::size_type size_type
Definition: xstring:706
template<size_t _Bits>
_Ty bitset< _Bits >::_Getword ( size_t  _Wpos) const
inlineprivate
448  { // get word at _Wpos
449  return (_Array[_Wpos]);
450  }
_Ty _Array[_Words+1]
Definition: bitset:497
template<size_t _Bits>
void bitset< _Bits >::_Tidy ( _Ty  _Wordval = 0)
inlineprivate
461  { // set all words to _Wordval
462  for (ptrdiff_t _Wpos = _Words; 0 <= _Wpos; --_Wpos)
463  _Array[_Wpos] = _Wordval;
464  if (_Wordval != 0)
465  _Trim();
466  }
Definition: bitset:457
void _Trim()
Definition: bitset:468
_W64 int ptrdiff_t
Definition: crtdefs.h:530
_Ty _Array[_Words+1]
Definition: bitset:497
template<size_t _Bits>
void bitset< _Bits >::_Trim ( )
inlineprivate
469  { // clear any trailing bits in last word
471  }
Definition: xtr1common:34
void _Trim_if(true_type)
Definition: bitset:473
template<size_t _Bits>
void bitset< _Bits >::_Trim_if ( true_type  )
inlineprivate
474  { // bits to trim, remove them
475  _Array[_Words] &= ((_Ty)1 << _Bits % _Bitsperword) - 1;
476  }
Definition: bitset:457
_Ty _Array[_Words+1]
Definition: bitset:497
Definition: bitset:456
template<size_t _Bits>
void bitset< _Bits >::_Trim_if ( false_type  )
inlineprivate
479  { // no bits to trim, do nothing
480  }
template<size_t _Bits>
bool bitset< _Bits >::all ( ) const
inlineprivate
433  { // test if all bits set
434  return (count() == size());
435  }
size_t count() const _NOEXCEPT
Definition: bitset:359
size_t size() const _NOEXCEPT
Definition: bitset:387
template<size_t _Bits>
bool bitset< _Bits >::any ( ) const
inlineprivate
420  { // test if any bits are set
421  for (ptrdiff_t _Wpos = _Words; 0 <= _Wpos; --_Wpos)
422  if (_Array[_Wpos] != 0)
423  return (true);
424  return (false);
425  }
Definition: bitset:457
_W64 int ptrdiff_t
Definition: crtdefs.h:530
_Ty _Array[_Words+1]
Definition: bitset:497
template<size_t _Bits>
bool bitset< _Bits >::at ( size_t  _Pos) const
inlineprivate
84  { // subscript nonmutable sequence with checking
85  return (test(_Pos));
86  }
bool test(size_t _Pos) const
Definition: bitset:411
template<size_t _Bits>
reference bitset< _Bits >::at ( size_t  _Pos)
inlineprivate
89  { // subscript mutable sequence with checking
90  return (reference(*this, _Pos));
91  }
reference() _NOEXCEPT
Definition: bitset:69
template<size_t _Bits>
size_t bitset< _Bits >::count ( ) const
inlineprivate
360  { // count number of set bits
361  const char *const _Bitsperbyte =
362  "\0\1\1\2\1\2\2\3\1\2\2\3\2\3\3\4"
363  "\1\2\2\3\2\3\3\4\2\3\3\4\3\4\4\5"
364  "\1\2\2\3\2\3\3\4\2\3\3\4\3\4\4\5"
365  "\2\3\3\4\3\4\4\5\3\4\4\5\4\5\5\6"
366  "\1\2\2\3\2\3\3\4\2\3\3\4\3\4\4\5"
367  "\2\3\3\4\3\4\4\5\3\4\4\5\4\5\5\6"
368  "\2\3\3\4\3\4\4\5\3\4\4\5\4\5\5\6"
369  "\3\4\4\5\4\5\5\6\4\5\5\6\5\6\6\7"
370  "\1\2\2\3\2\3\3\4\2\3\3\4\3\4\4\5"
371  "\2\3\3\4\3\4\4\5\3\4\4\5\4\5\5\6"
372  "\2\3\3\4\3\4\4\5\3\4\4\5\4\5\5\6"
373  "\3\4\4\5\4\5\5\6\4\5\5\6\5\6\6\7"
374  "\2\3\3\4\3\4\4\5\3\4\4\5\4\5\5\6"
375  "\3\4\4\5\4\5\5\6\4\5\5\6\5\6\6\7"
376  "\3\4\4\5\4\5\5\6\4\5\5\6\5\6\6\7"
377  "\4\5\5\6\5\6\6\7\5\6\6\7\6\7\7\x8";
378  const unsigned char *_Ptr =
379  (const unsigned char *)(const void *)_Array;
380  const unsigned char *const _End = _Ptr + sizeof (_Array);
381  size_t _Val = 0;
382  for ( ; _Ptr != _End; ++_Ptr)
383  _Val += _Bitsperbyte[*_Ptr];
384  return (_Val);
385  }
_Ty _Array[_Words+1]
Definition: bitset:497
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<size_t _Bits>
reference& bitset< _Bits >::flip ( )
inline
53  { // complement stored element
54  _Pbitset->flip(_Mypos);
55  return (*this);
56  }
bitset< _Bits > * _Pbitset
Definition: bitset:79
size_t _Mypos
Definition: bitset:80
template<size_t _Bits>
bitset<_Bits>& bitset< _Bits >::flip ( )
inlineprivate
274  { // flip all bits
275  for (ptrdiff_t _Wpos = _Words; 0 <= _Wpos; --_Wpos)
276  _Array[_Wpos] = (_Ty)~_Array[_Wpos];
277 
278  _Trim();
279  return (*this);
280  }
Definition: bitset:457
void _Trim()
Definition: bitset:468
_W64 int ptrdiff_t
Definition: crtdefs.h:530
_Ty _Array[_Words+1]
Definition: bitset:497
template<size_t _Bits>
bitset<_Bits>& bitset< _Bits >::flip ( size_t  _Pos)
inlineprivate
283  { // flip bit at _Pos
284  if (_Bits <= _Pos)
285  _Xran(); // _Pos off end
286  _Array[_Pos / _Bitsperword] ^= (_Ty)1 << _Pos % _Bitsperword;
287  return (*this);
288  }
_Ty _Array[_Words+1]
Definition: bitset:497
Definition: bitset:456
template<size_t _Bits>
size_t bitset< _Bits >::hash ( ) const
inlineprivate
393  { // hash bits to size_t value by pseudorandomizing transform
394  return (_Hash_seq((const unsigned char *)_Array,
395  sizeof (_Array)));
396  }
_STD_BEGIN size_t _Hash_seq(const unsigned char *_First, size_t _Count)
Definition: xstddef:279
_Ty _Array[_Words+1]
Definition: bitset:497
template<size_t _Bits>
bool bitset< _Bits >::none ( ) const
inlineprivate
428  { // test if no bits are set
429  return (!any());
430  }
bool any() const _NOEXCEPT
Definition: bitset:419
template<size_t _Bits>
bitset< _Bits >::operator bool ( ) const
inline
64  { // return element
65  return (_Pbitset->test(_Mypos));
66  }
bitset< _Bits > * _Pbitset
Definition: bitset:79
size_t _Mypos
Definition: bitset:80
template<size_t _Bits>
bool bitset< _Bits >::operator!= ( const bitset< _Bits > &  _Right) const
inlineprivate
407  { // test for bitset inequality
408  return (!(*this == _Right));
409  }
template<size_t _Bits>
bitset<_Bits>& bitset< _Bits >::operator&= ( const bitset< _Bits > &  _Right)
inlineprivate
182  { // AND in _Right
183  for (ptrdiff_t _Wpos = _Words; 0 <= _Wpos; --_Wpos)
184  _Array[_Wpos] &= _Right._Getword(_Wpos);
185  return (*this);
186  }
Definition: bitset:457
_W64 int ptrdiff_t
Definition: crtdefs.h:530
_Ty _Array[_Words+1]
Definition: bitset:497
_Ty _Getword(size_t _Wpos) const
Definition: bitset:447
template<size_t _Bits>
bitset<_Bits> bitset< _Bits >::operator<< ( size_t  _Pos) const
inlineprivate
438  { // return bitset shifted left by _Pos
439  return (bitset<_Bits>(*this) <<= _Pos);
440  }
Definition: bitset:21
template<size_t _Bits>
bitset<_Bits>& bitset< _Bits >::operator<<= ( size_t  _Pos)
inlineprivate
203  { // shift left by _Pos
204  const ptrdiff_t _Wordshift = (ptrdiff_t)(_Pos / _Bitsperword);
205  if (_Wordshift != 0)
206  for (ptrdiff_t _Wpos = _Words; 0 <= _Wpos; --_Wpos)
207  _Array[_Wpos] = _Wordshift <= _Wpos // shift by words
208  ? _Array[_Wpos - _Wordshift] : (_Ty)0;
209 
210  if ((_Pos %= _Bitsperword) != 0)
211  { // 0 < _Pos < _Bitsperword, shift by bits
212  for (ptrdiff_t _Wpos = _Words; 0 < _Wpos; --_Wpos)
213  _Array[_Wpos] = (_Ty)((_Array[_Wpos] << _Pos)
214  | (_Array[_Wpos - 1] >> (_Bitsperword - _Pos)));
215  _Array[0] <<= _Pos;
216  }
217  _Trim();
218  return (*this);
219  }
Definition: bitset:457
void _Trim()
Definition: bitset:468
_W64 int ptrdiff_t
Definition: crtdefs.h:530
_Ty _Array[_Words+1]
Definition: bitset:497
Definition: bitset:456
template<size_t _Bits>
reference& bitset< _Bits >::operator= ( const reference _Bitref)
inline
47  { // assign reference to element
48  _Pbitset->set(_Mypos, bool(_Bitref));
49  return (*this);
50  }
bitset< _Bits > * _Pbitset
Definition: bitset:79
size_t _Mypos
Definition: bitset:80
template<size_t _Bits>
bool bitset< _Bits >::operator== ( const bitset< _Bits > &  _Right) const
inlineprivate
399  { // test for bitset equality
400  for (ptrdiff_t _Wpos = _Words; 0 <= _Wpos; --_Wpos)
401  if (_Array[_Wpos] != _Right._Getword(_Wpos))
402  return (false);
403  return (true);
404  }
Definition: bitset:457
_W64 int ptrdiff_t
Definition: crtdefs.h:530
_Ty _Array[_Words+1]
Definition: bitset:497
_Ty _Getword(size_t _Wpos) const
Definition: bitset:447
template<size_t _Bits>
bitset<_Bits> bitset< _Bits >::operator>> ( size_t  _Pos) const
inlineprivate
443  { // return bitset shifted right by _Pos
444  return (bitset<_Bits>(*this) >>= _Pos);
445  }
Definition: bitset:21
template<size_t _Bits>
bitset<_Bits>& bitset< _Bits >::operator>>= ( size_t  _Pos)
inlineprivate
222  { // shift right by _Pos, first by words then by bits
223  const ptrdiff_t _Wordshift = (ptrdiff_t)(_Pos / _Bitsperword);
224  if (_Wordshift != 0)
225  for (ptrdiff_t _Wpos = 0; _Wpos <= _Words; ++_Wpos)
226  _Array[_Wpos] = _Wordshift <= _Words - _Wpos
227  ? _Array[_Wpos + _Wordshift] : (_Ty)0;
228 
229  if ((_Pos %= _Bitsperword) != 0)
230  { // 0 < _Pos < _Bitsperword, shift by bits
231  for (ptrdiff_t _Wpos = 0; _Wpos < _Words; ++_Wpos)
232  _Array[_Wpos] = (_Ty)((_Array[_Wpos] >> _Pos)
233  | (_Array[_Wpos + 1] << (_Bitsperword - _Pos)));
234  _Array[_Words] >>= _Pos;
235  }
236  return (*this);
237  }
Definition: bitset:457
_W64 int ptrdiff_t
Definition: crtdefs.h:530
_Ty _Array[_Words+1]
Definition: bitset:497
Definition: bitset:456
template<size_t _Bits>
bool bitset< _Bits >::operator[] ( size_t  _Pos) const
inlineprivate
94  { // subscript nonmutable sequence
95  return (test(_Pos));
96  }
bool test(size_t _Pos) const
Definition: bitset:411
template<size_t _Bits>
reference bitset< _Bits >::operator[] ( size_t  _Pos)
inlineprivate
99  { // subscript mutable sequence
100  #if _ITERATOR_DEBUG_LEVEL == 2
101  if (_Bits <= _Pos)
102  _DEBUG_ERROR("bitset index outside range");
103 
104  #elif _ITERATOR_DEBUG_LEVEL == 1
105  _SCL_SECURE_VALIDATE_RANGE(_Pos < _Bits);
106  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
107 
108  return (reference(*this, _Pos));
109  }
reference() _NOEXCEPT
Definition: bitset:69
#define _SCL_SECURE_VALIDATE_RANGE(cond)
Definition: yvals.h:347
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
template<size_t _Bits>
bitset<_Bits>& bitset< _Bits >::operator^= ( const bitset< _Bits > &  _Right)
inlineprivate
196  { // XOR in _Right
197  for (ptrdiff_t _Wpos = _Words; 0 <= _Wpos; --_Wpos)
198  _Array[_Wpos] ^= _Right._Getword(_Wpos);
199  return (*this);
200  }
Definition: bitset:457
_W64 int ptrdiff_t
Definition: crtdefs.h:530
_Ty _Array[_Words+1]
Definition: bitset:497
_Ty _Getword(size_t _Wpos) const
Definition: bitset:447
template<size_t _Bits>
bitset<_Bits>& bitset< _Bits >::operator|= ( const bitset< _Bits > &  _Right)
inlineprivate
189  { // OR in _Right
190  for (ptrdiff_t _Wpos = _Words; 0 <= _Wpos; --_Wpos)
191  _Array[_Wpos] |= _Right._Getword(_Wpos);
192  return (*this);
193  }
Definition: bitset:457
_W64 int ptrdiff_t
Definition: crtdefs.h:530
_Ty _Array[_Words+1]
Definition: bitset:497
_Ty _Getword(size_t _Wpos) const
Definition: bitset:447
template<size_t _Bits>
bool bitset< _Bits >::operator~ ( ) const
inline
59  { // return complemented element
60  return (!_Pbitset->test(_Mypos));
61  }
bitset< _Bits > * _Pbitset
Definition: bitset:79
size_t _Mypos
Definition: bitset:80
template<size_t _Bits>
bitset<_Bits> bitset< _Bits >::operator~ ( ) const
inlineprivate
269  { // flip all bits
270  return (bitset<_Bits>(*this).flip());
271  }
reference & flip() _NOEXCEPT
Definition: bitset:52
Definition: bitset:21
template<size_t _Bits>
bitset< _Bits >::reference ( )
inlineprivate
70  : _Pbitset(0), _Mypos(0)
71  { // default construct
72  }
bitset< _Bits > * _Pbitset
Definition: bitset:79
size_t _Mypos
Definition: bitset:80
template<size_t _Bits>
bitset< _Bits >::reference ( bitset< _Bits > &  _Bitset,
size_t  _Pos 
)
inlineprivate
75  : _Pbitset(&_Bitset), _Mypos(_Pos)
76  { // construct from bitset reference and position
77  }
bitset< _Bits > * _Pbitset
Definition: bitset:79
size_t _Mypos
Definition: bitset:80
template<size_t _Bits>
bitset<_Bits>& bitset< _Bits >::reset ( )
inlineprivate
258  { // set all bits false
259  _Tidy();
260  return (*this);
261  }
void _Tidy(_Ty _Wordval=0)
Definition: bitset:460
template<size_t _Bits>
bitset<_Bits>& bitset< _Bits >::reset ( size_t  _Pos)
inlineprivate
264  { // set bit at _Pos to false
265  return (set(_Pos, false));
266  }
bitset< _Bits > & set() _NOEXCEPT
Definition: bitset:239
template<size_t _Bits>
bitset<_Bits>& bitset< _Bits >::set ( )
inlineprivate
240  { // set all bits true
241  _Tidy((_Ty)~0);
242  return (*this);
243  }
void _Tidy(_Ty _Wordval=0)
Definition: bitset:460
template<size_t _Bits>
bitset<_Bits>& bitset< _Bits >::set ( size_t  _Pos,
bool  _Val = true 
)
inlineprivate
247  { // set bit at _Pos to _Val
248  if (_Bits <= _Pos)
249  _Xran(); // _Pos off end
250  if (_Val)
251  _Array[_Pos / _Bitsperword] |= (_Ty)1 << _Pos % _Bitsperword;
252  else
253  _Array[_Pos / _Bitsperword] &= ~((_Ty)1 << _Pos % _Bitsperword);
254  return (*this);
255  }
_Ty _Array[_Words+1]
Definition: bitset:497
Definition: bitset:456
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<size_t _Bits>
size_t bitset< _Bits >::size ( ) const
inlineprivate
388  { // return size of bitset
389  return (_Bits);
390  }
template<size_t _Bits>
bool bitset< _Bits >::test ( size_t  _Pos) const
inlineprivate
412  { // test if bit at _Pos is set
413  if (_Bits <= _Pos)
414  _Xran(); // _Pos off end
415  return ((_Array[_Pos / _Bitsperword]
416  & ((_Ty)1 << _Pos % _Bitsperword)) != 0);
417  }
_Ty _Array[_Words+1]
Definition: bitset:497
Definition: bitset:456
template<size_t _Bits>
template<class _Elem , class _Tr , class _Alloc >
basic_string<_Elem, _Tr, _Alloc> bitset< _Bits >::to_string ( _Elem  _E0 = (_Elem)'0',
_Elem  _E1 = (_Elem)'1' 
) const
inlineprivate
322  { // convert bitset to string
325  _Str.reserve(_Bits);
326 
327  for (_Pos = _Bits; 0 < _Pos; )
328  if (test(--_Pos))
329  _Str += _E1;
330  else
331  _Str += _E0;
332  return (_Str);
333  }
void reserve(size_type _Newcap=0)
Definition: xstring:1781
_Mybase::size_type size_type
Definition: xstring:706
Definition: xstring:21
bool test(size_t _Pos) const
Definition: bitset:411
template<size_t _Bits>
template<class _Elem , class _Tr >
basic_string<_Elem, _Tr, allocator<_Elem> > bitset< _Bits >::to_string ( _Elem  _E0 = (_Elem)'0',
_Elem  _E1 = (_Elem)'1' 
) const
inlineprivate
340  { // convert bitset to string
341  return (to_string<_Elem, _Tr, allocator<_Elem> >(_E0, _E1));
342  }
basic_string< _Elem, _Tr, _Alloc > to_string(_Elem _E0=(_Elem)'0', _Elem _E1=(_Elem)'1') const
Definition: bitset:320
Definition: iosfwd:611
template<size_t _Bits>
template<class _Elem >
basic_string<_Elem, char_traits<_Elem>, allocator<_Elem> > bitset< _Bits >::to_string ( _Elem  _E0 = (_Elem)'0',
_Elem  _E1 = (_Elem)'1' 
) const
inlineprivate
348  { // convert bitset to string
349  return (to_string<_Elem, char_traits<_Elem>,
350  allocator<_Elem> >(_E0, _E1));
351  }
basic_string< _Elem, _Tr, _Alloc > to_string(_Elem _E0=(_Elem)'0', _Elem _E1=(_Elem)'1') const
Definition: bitset:320
Definition: iosfwd:611
Definition: iosfwd:260
template<size_t _Bits>
string bitset< _Bits >::to_string ( char  _E0 = '0',
char  _E1 = '1' 
) const
inlineprivate
354  { // convert bitset to string
356  _E0, _E1));
357  }
basic_string< _Elem, _Tr, _Alloc > to_string(_Elem _E0=(_Elem)'0', _Elem _E1=(_Elem)'1') const
Definition: bitset:320
Definition: iosfwd:611
Definition: iosfwd:504
template<size_t _Bits>
_ULonglong bitset< _Bits >::to_ullong ( ) const
inlineprivate
300  { // convert bitset to unsigned long long
301  static_assert(sizeof (_ULonglong) % sizeof (_Ty) == 0,
302  "unsigned long long not multiple of _Ty");
303 
304  ptrdiff_t _Wpos = _Words;
305  for (; (ptrdiff_t)(sizeof (_ULonglong) / sizeof (_Ty)) <= _Wpos;
306  --_Wpos)
307  if (_Array[_Wpos] != 0)
308  _Xoflo(); // fail if any high-order words are nonzero
309 
310  _ULonglong _Val = _Array[_Wpos];
311  for (; 0 <= --_Wpos; )
312  _Val = ((_Val << (_Bitsperword - 1)) << 1) | _Array[_Wpos];
313  return (_Val);
314  }
Definition: bitset:457
_W64 int ptrdiff_t
Definition: crtdefs.h:530
_Ty _Array[_Words+1]
Definition: bitset:497
Definition: bitset:456
_FwdIt const _Ty _Val
Definition: algorithm:1938
_ULONGLONG _ULonglong
Definition: yvals.h:587
template<size_t _Bits>
unsigned long bitset< _Bits >::to_ulong ( ) const
inlineprivate
291  { // convert bitset to unsigned long
293  unsigned long _Ans = (unsigned long)_Val;
294  if (_Ans != _Val)
295  _Xoflo();
296  return (_Ans);
297  }
_ULonglong to_ullong() const _NOEXCEPT
Definition: bitset:299
_FwdIt const _Ty _Val
Definition: algorithm:1938
_ULONGLONG _ULonglong
Definition: yvals.h:587

Member Data Documentation

template<size_t _Bits>
_Ty bitset< _Bits >::_Array[_Words+1]
private
template<size_t _Bits>
size_t bitset< _Bits >::_Mypos
private
template<size_t _Bits>
bitset<_Bits>* bitset< _Bits >::_Pbitset
private
template<size_t _Bits>
return* bitset< _Bits >::this

The documentation for this class was generated from the following file: