19 #ifndef _STLP_BITSET_H 20 #define _STLP_BITSET_H 38 #ifndef _STLP_INTERNAL_ALGOBASE_H 42 #ifndef _STLP_INTERNAL_ALLOC_H 46 #ifndef _STLP_INTERNAL_ITERATOR_H 50 #ifndef _STLP_INTERNAL_UNINITIALIZED_H 54 #ifndef _STLP_RANGE_ERRORS_H 58 #ifndef _STLP_INTERNAL_STRING_H 62 #define __BITS_PER_WORD (CHAR_BIT*sizeof(unsigned long)) 63 #define __BITSET_WORDS(__n) ((__n + __BITS_PER_WORD - 1)/__BITS_PER_WORD) 74 static size_t _S_count(
const unsigned char *__beg,
const unsigned char *__end)
75 #if defined (_STLP_USE_NO_IOSTREAMS) 78 for (; __beg != __end; ++__beg) {
79 for (
size_t i = 0;
i < (
sizeof(
unsigned char) * 8); ++
i) {
80 if ((*__beg & (1 <<
i)) != 0) { ++__result; }
89 static unsigned char _S_first_one(
unsigned char __x)
90 #if defined (_STLP_USE_NO_IOSTREAMS) 92 for (
unsigned char i = 0;
i < (
sizeof(
unsigned char) * 8); ++
i) {
93 if ((__x & (1 <<
i)) != 0) {
return i; }
139 for (
size_t __i = 0; __i < _Nw; __i++ ) {
145 for (
size_t __i = 0; __i < _Nw; __i++ ) {
151 for (
size_t __i = 0; __i < _Nw; __i++ ) {
161 for (
size_t __i = 0; __i < _Nw; __i++ ) {
167 for (
size_t __i = 0; __i < _Nw; __i++ ) {
175 for (
size_t __i = 0; __i < _Nw; ++__i) {
183 for (
size_t __i = 0; __i < _Nw ; __i++ ) {
191 const unsigned char* __byte_ptr = (
const unsigned char*)
_M_w;
192 const unsigned char* __end_ptr = (
const unsigned char*)(
_M_w+_Nw);
255 const unsigned char* __byte_ptr = (
const unsigned char*)&
_M_w;
256 const unsigned char* __end_ptr = ((
const unsigned char*)&
_M_w)+
sizeof(
_M_w);
265 inline size_t _M_do_find_next(
size_t __prev,
size_t __not_found)
const;
281 for (
size_t __j = 0; __j <
sizeof(
_WordT); __j++ ) {
282 unsigned char __this_byte
283 =
__STATIC_CAST(
unsigned char,(__thisword & (~(
unsigned char)0)));
296 size_t __not_found )
const {
315 unsigned char __this_byte
316 =
__STATIC_CAST(
unsigned char,(__thisword & (~(
unsigned char)0)));
374 _M_wp = &__b._M_getword(__pos);
375 _M_bpos = _Bitset_base::_S_whichbit(__pos);
393 if ( (*(__j.
_M_wp) & _Bitset_base::_S_maskbit(__j.
_M_bpos)) )
419 #if defined (_STLP_MEMBER_TEMPLATES) 420 template<
class _CharT,
class _Traits,
class _Alloc>
424 if (__pos > __s.
size())
429 template<
class _CharT,
class _Traits,
class _Alloc>
434 if (__pos > __s.
size())
441 size_t __n = (
size_t)-1)
443 if (__pos > __s.
size())
451 this->_M_do_and(__rhs);
456 this->_M_do_or(__rhs);
461 this->_M_do_xor(__rhs);
466 this->_M_do_left_shift(__pos);
472 this->_M_do_right_shift(__pos);
489 this->_M_getword(__pos) |= this->_S_maskbit(__pos);
491 this->_M_getword(__pos) &= ~ this->_S_maskbit(__pos);
497 this->_M_getword(__pos) &= ~ this->_S_maskbit(__pos);
502 this->_M_getword(__pos) ^= this->_S_maskbit(__pos);
564 unsigned long to_ulong()
const {
return this->_M_do_to_ulong(); }
566 #if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) 567 template <
class _CharT,
class _Traits,
class _Alloc>
581 size_t count()
const {
return this->_M_do_count(); }
583 size_t size()
const {
return _Nb; }
586 return this->_M_is_equal(__rhs);
589 return !this->_M_is_equal(__rhs);
592 bool test(
size_t __pos)
const {
599 bool any()
const {
return this->_M_is_any(); }
600 bool none()
const {
return !this->_M_is_any(); }
604 __result <<= __pos ;
return __result;
608 __result >>= __pos ;
return __result;
611 #if !defined (_STLP_NO_EXTENSIONS) 620 {
return this->_M_do_find_first(_Nb); }
624 {
return this->_M_do_find_next(__prev, _Nb); }
630 #if defined (_STLP_MEMBER_TEMPLATES) 631 template<
class _CharT,
class _Traits,
class _Alloc>
633 size_t __pos,
size_t __n) {
636 size_t __pos,
size_t __n) {
641 const size_t __Nbits = (
min) (__tmp, (
min) (
__n, __s.
size() - __pos));
642 for (
size_t __i= 0; __i < __Nbits; ++__i) {
643 typename _Traits::int_type __k = _Traits::to_int_type(__s[__pos + __Nbits - __i - 1]);
652 #if defined (_STLP_MEMBER_TEMPLATES) 653 template <
class _CharT,
class _Traits,
class _Alloc>
661 for (
size_t __i = 0; __i < _Nb; ++__i) {
663 __s[_Nb - 1 - __i] =
'1';
667 #if !defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_WCHAR_T) 669 __s.assign(_Nb,
'0');
671 for (
size_t __i = 0; __i < _Nb; ++__i) {
673 __s[_Nb - 1 - __i] =
'1';
678 #if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) 701 #if ! defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) 702 template <
size_t _Nb>
712 template <
size_t _Nb>
721 template <
size_t _Nb>
730 #if !defined (_STLP_USE_NO_IOSTREAMS) 734 # if !(defined (_STLP_MSVC) && (_STLP_MSVC < 1300)) && \ 735 !(defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x500)) 737 #ifndef _STLP_INTERNAL_IOSFWD 743 template <
class _CharT,
class _Traits,
size_t _Nb>
747 template <
class _CharT,
class _Traits,
size_t _Nb>
753 #ifndef _STLP_STRING_IO_H 759 template <
size_t _Nb>
767 typename istream::sentry __sentry(__is);
770 for (
size_t __i = 0; __i < _Nb; ++__i) {
771 static typename _Traits::int_type __eof =
_Traits::eof();
773 typename _Traits::int_type __c1 = __buf->
sbumpc();
774 if (_Traits::eq_int_type(__c1, __eof)) {
779 typename _Traits::char_type __c2 = _Traits::to_char_type(__c1);
782 if (
__c ==
'0' ||
__c ==
'1')
784 else if (_Traits::eq_int_type(__buf->
sputbackc(__c2), __eof)) {
800 template <
size_t _Nb>
805 return __os << __tmp;
808 # if !defined (_STLP_NO_WCHAR_T) 810 template <
size_t _Nb>
813 typedef typename wstring::traits_type _Traits;
821 for (
size_t __i = 0; __i < _Nb; ++__i) {
822 static typename _Traits::int_type __eof =
_Traits::eof();
824 typename _Traits::int_type __c1 = __buf->
sbumpc();
825 if (_Traits::eq_int_type(__c1, __eof)) {
830 typename _Traits::char_type __c2 = _Traits::to_char_type(__c1);
833 if (
__c ==
'0' ||
__c ==
'1')
834 __tmp.push_back(
__c);
835 else if (_Traits::eq_int_type(__buf->
sputbackc(__c2), __eof)) {
851 template <
size_t _Nb>
856 return __os << __tmp;
869 #undef __BITS_PER_WORD 870 #undef __BITSET_WORDS 872 #if !defined (_STLP_LINK_TIME_INSTANTIATION)
size_t _Find_first() const
#define __BITSET_WORDS(__n)
static size_t _STLP_CALL _S_whichword(size_t __pos)
bitset< _Nb > & operator<<=(size_t __pos)
void _M_do_xor(const _Base_bitset< _Nw > &__x)
bitset< _Nb > & _Unchecked_flip(size_t __pos)
bool operator==(const bitset< _Nb > &__rhs) const
bool _M_is_equal(const _Self &__x) const
bitset< _Nb > & _Unchecked_set(size_t __pos, int __val)
bitset< _Nb > operator<<(size_t __pos) const
basic_streambuf< _CharT, _Traits > * rdbuf() const
static unsigned char _S_first_one(unsigned char __x)
size_t _M_do_count() const
bool operator[](size_t __pos) const
bitset< _Nb > & _Unchecked_reset(size_t __pos)
#define __STATIC_CAST(__x, __y)
reference & operator=(bool __x)
_WordT _M_getword(size_t) const
_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_invalid_argument(const char *__msg)
bitset< _Nb > operator~() const
void _M_do_left_shift(size_t __shift)
bitset< _Nb > _STLP_CALL operator^(const bitset< _Nb > &__x, const bitset< _Nb > &__y)
static size_t _S_count(const unsigned char *__beg, const unsigned char *__end)
bitset< _Nb > & operator>>=(size_t __pos)
void _M_do_and(const _Base_bitset< _Nw > &__x)
_WordT & _M_getword(size_t __pos)
void _M_do_right_shift(size_t __shift)
void _M_do_or(const _Self &__x)
#define _STLP_MOVE_TO_PRIV_NAMESPACE
bitset< _Nb > & operator^=(const bitset< _Nb > &__rhs)
_Base_bitset(unsigned long __val)
bitset< _Nb > & _Unchecked_set(size_t __pos)
char narrow(_CharT, char) const
static size_t _STLP_CALL _S_whichbyte(size_t __pos)
void _M_do_right_shift(size_t __shift)
static size_t _STLP_CALL _S_whichbit(size_t __pos)
static void _STLP_CALL _M_do_sanitize(unsigned long)
char_traits< char > traits_type
bool operator!=(const bitset< _Nb > &__rhs) const
bool _M_is_equal(const _Base_bitset< _Nw > &__x) const
bitset< _Nb > operator>>(size_t __pos) const
bitset< _Nb > & flip(size_t __pos)
unsigned long _M_do_to_ulong() const
void _M_copy_to_string(string &__s) const
size_t _M_do_find_first(size_t __not_found) const
typedef bool(CARDLIBPROC *pCanDragProc)(CardRegion &stackobj
bitset< _Nb > _STLP_CALL operator &(const bitset< _Nb > &__x, const bitset< _Nb > &__y)
bitset< _Nb > & operator&=(const bitset< _Nb > &__rhs)
static size_t _STLP_CALL _S_whichword(size_t __pos)
static size_t _STLP_CALL _S_whichbit(size_t __pos)
#define _STLP_MOVE_TO_STD_NAMESPACE
_WordT _M_getword(size_t __pos) const
bitset< _Nb > & reset(size_t __pos)
_STLP_INLINE_LOOP _InputIter const _Tp & __val
_Self & assign(const _Self &__s)
_STLP_PRIV _Base_bitset< _Words > _Bitset_base
_WordT & _M_getword(size_t)
void push_back(_CharT __c)
size_t _M_do_count() const
size_t _M_do_find_next(size_t __prev, size_t __not_found) const
_Base_bitset< 1UL > _Self
static size_t _STLP_CALL _S_whichbyte(size_t __pos)
void _M_do_xor(const _Self &__x)
_Base_bitset(unsigned long __val)
#define _STLP_CLASS_DECLSPEC
void setstate(iostate __state)
static _WordT _STLP_CALL _S_maskbit(size_t __pos)
void _M_copy_to_string(wstring &__s) const
#define _STLP_TEMPLATE_NULL
unsigned long _M_do_to_ulong() const
_Check_return_ _CRTIMP int __cdecl __cdecl eof(_In_ int _FileHandle)
bitset< _Nb > & set(size_t __pos)
bitset(unsigned long __val)
bitset< _Nb > _STLP_CALL operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y)
void _M_copy_from_string(const string &__s, size_t __pos, size_t __n)
static _WordT _STLP_CALL _S_maskbit(size_t __pos)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
reference & operator=(const reference &__j)
#define _STLP_END_NAMESPACE
int_type sputbackc(char_type __c)
size_t _Find_next(size_t __prev) const
bool _Unchecked_test(size_t __pos) const
#define _STLP_BEGIN_NAMESPACE
_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_out_of_range(const char *__msg)
void reserve(size_type=0)
unsigned long to_ulong() const
reference operator[](size_t __pos)
reference(_Bitset &__b, size_t __pos)
_STLP_PRIV _Base_bitset< _Words > _Base
static void _STLP_CALL _M_do_sanitize(unsigned long &__val)
bitset< _Nb > & operator|=(const bitset< _Nb > &__rhs)
void _M_do_or(const _Base_bitset< _Nw > &__x)
bitset< _Nb > & set(size_t __pos, int __val)
void _M_do_left_shift(size_t __shift)
bool test(size_t __pos) const
void _M_do_and(const _Self &__x)
bitset(const string &__s, size_t __pos=0, size_t __n=(size_t) -1)