30#ifndef _STLP_INTERNAL_BVECTOR_H
31#define _STLP_INTERNAL_BVECTOR_H
33#ifndef _STLP_INTERNAL_VECTOR_H
37#define _STLP_WORD_BIT (int(CHAR_BIT * sizeof(unsigned int)))
56 else *
_M_p &= ~_M_mask;
60 return *
this =
bool(__x);
86 bool __tmp = (
bool)__x;
126#if defined(_MSC_VER) && _MSC_VER<=1401 && defined(MIPS) && defined(NDEBUG)
168template <
class _Ref,
class _Ptr>
230template <
class _Ref,
class _Ptr>
238#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
239template <
class _Ref,
class _Ptr>
249#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
267template <
class _Alloc>
282#if !defined (_STLP_NO_MOVE_SEMANTIC)
287 src.get()._M_start._M_p = 0;
320#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_BOOL) && !defined (__SUNPRO_CC)
321# define _STLP_VECBOOL_TEMPLATE
322# define __BVEC_TMPL_HEADER template <class _Alloc>
324# undef _STLP_VECBOOL_TEMPLATE
326# define __BVEC_TMPL_HEADER
328# define __BVEC_TMPL_HEADER _STLP_TEMPLATE_NULL
330# define _Alloc allocator<bool>
333#if defined (_STLP_DEBUG)
334# define vector _STLP_NON_DBG_NAME(vector)
338# define __BVECTOR_QUALIFIED bit_vector
339# define __BVECTOR bit_vector
341# ifdef _STLP_VECBOOL_TEMPLATE
342# define __BVECTOR_QUALIFIED vector<bool, _Alloc>
344# define __BVECTOR_QUALIFIED vector<bool, allocator<bool> >
346# if defined (_STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS)
347# define __BVECTOR __BVECTOR_QUALIFIED
349# define __BVECTOR vector
353#if !defined (_STLP_DEBUG) || defined (_STLP_NO_BOOL)
359#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_DEBUG)
380#ifdef _STLP_VECBOOL_TEMPLATE
392 this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(
__n);
397 if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) {
408 this->_M_finish = _STLP_STD::copy(__position,
end(), __i);
409 this->_M_deallocate();
410 this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
415#if defined (_STLP_MEMBER_TEMPLATES)
416 template <
class _InputIterator>
417 void _M_initialize_range(_InputIterator __first, _InputIterator
__last,
421 this->_M_end_of_storage._M_data = 0;
422 for ( ; __first !=
__last; ++__first)
426 template <
class _ForwardIterator>
427 void _M_initialize_range(_ForwardIterator __first, _ForwardIterator
__last,
429 size_type
__n = _STLP_STD::distance(__first,
__last);
431 _STLP_STD::copy(__first,
__last, this->_M_start);
434 template <
class _InputIterator>
435 void _M_insert_range(
iterator __pos,
436 _InputIterator __first, _InputIterator
__last,
438 for ( ; __first !=
__last; ++__first) {
439 __pos =
insert(__pos, *__first);
444 template <
class _ForwardIterator>
445 void _M_insert_range(
iterator __position,
446 _ForwardIterator __first, _ForwardIterator
__last,
449 size_type
__n = _STLP_STD::distance(__first,
__last);
453 _STLP_STD::copy(__first,
__last, __position);
454 this->_M_finish += difference_type(
__n);
458 __chunk_type* __q = this->_M_bit_alloc(__len);
460 __i = _STLP_STD::copy(__first,
__last, __i);
461 this->_M_finish = _STLP_STD::copy(__position,
end(), __i);
462 this->_M_deallocate();
463 this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
479 return const_reverse_iterator(
end());
482 const_reverse_iterator
rend()
const {
483 return const_reverse_iterator(
begin());
520 fill(this->_M_start._M_p, (
__chunk_type*)(this->_M_end_of_storage._M_data), 0);
526 _STLP_STD::copy(__x.
begin(), __x.
end(), this->_M_start);
529#if defined (_STLP_MEMBER_TEMPLATES)
530 template <
class _Integer>
531 void _M_initialize_dispatch(_Integer
__n, _Integer __x,
const __true_type&) {
533 fill(this->_M_start._M_p, this->_M_end_of_storage._M_data, __x ? ~0 : 0);
536 template <
class _InputIterator>
537 void _M_initialize_dispatch(_InputIterator __first, _InputIterator
__last,
541# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
543 template <
class _InputIterator>
547 _M_initialize_dispatch(__first,
__last, _Integral());
550 template <
class _InputIterator>
555 _M_initialize_dispatch(__first,
__last, _Integral());
563 _STLP_STD::copy(__first,
__last, this->_M_start);
570 _STLP_STD::copy(__first,
__last, this->_M_start);
574#if !defined (_STLP_NO_MOVE_SEMANTIC)
582 if (&__x ==
this)
return *
this;
584 this->_M_deallocate();
599 fill(this->_M_start._M_p, (
__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0);
604 fill(this->_M_start._M_p, (
__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0);
609#if defined (_STLP_MEMBER_TEMPLATES)
610 template <
class _InputIterator>
611 void assign(_InputIterator __first, _InputIterator
__last) {
613 _M_assign_dispatch(__first,
__last, _Integral());
616 template <
class _Integer>
620 template <
class _InputIter>
624 template <
class _InputIterator>
625 void _M_assign_aux(_InputIterator __first, _InputIterator
__last,
628 for ( ; __first !=
__last && __cur !=
end(); ++__cur, ++__first)
636 template <
class _ForwardIterator>
637 void _M_assign_aux(_ForwardIterator __first, _ForwardIterator
__last,
639 size_type __len = _STLP_STD::distance(__first,
__last);
643 _ForwardIterator __mid = __first;
644 _STLP_STD::advance(__mid,
size());
645 _STLP_STD::copy(__first, __mid,
begin());
657 this->_M_finish = _STLP_STD::copy(
begin(),
end(), __z);
658 this->_M_deallocate();
660 this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(
__n);
669 if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) {
670 *(this->_M_finish) = __x;
677 _STLP_STD::swap(this->_M_start, __x._M_start);
678 _STLP_STD::swap(this->_M_finish, __x._M_finish);
679 this->_M_end_of_storage.swap(__x._M_end_of_storage);
681#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
687 if (this->_M_finish._M_p != this->_M_end_of_storage._M_data && __position ==
end()) {
688 *(this->_M_finish) = __x;
696#if defined (_STLP_MEMBER_TEMPLATES)
698 template <
class _Integer>
699 void _M_insert_dispatch(
iterator __pos, _Integer
__n, _Integer __x,
701 _M_fill_insert(__pos, (size_type)
__n, (
bool) __x);
704 template <
class _InputIterator>
705 void _M_insert_dispatch(
iterator __pos,
706 _InputIterator __first, _InputIterator
__last,
712 template <
class _InputIterator>
714 _InputIterator __first, _InputIterator
__last) {
716 _M_insert_dispatch(__position, __first,
__last, _Integral());
721 if (__first ==
__last)
return;
726 _STLP_STD::copy(__first,
__last, __position);
727 this->_M_finish +=
__n;
733 __i = _STLP_STD::copy(__first,
__last, __i);
734 this->_M_finish = _STLP_STD::copy(__position,
end(), __i);
735 this->_M_deallocate();
736 this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
742 if (__first ==
__last)
return;
747 _STLP_STD::copy(__first,
__last, __position);
748 this->_M_finish +=
__n;
754 __i = _STLP_STD::copy(__first,
__last, __i);
755 this->_M_finish = _STLP_STD::copy(__position,
end(), __i);
756 this->_M_deallocate();
757 this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
764 if (
__n == 0)
return;
777 this->_M_deallocate();
778 this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
791 if (__position + 1 !=
end())
792 _STLP_STD::copy(__position + 1,
end(), __position);
797 this->_M_finish = _STLP_STD::copy(
__last,
end(), __first);
801 if (__new_size <
size())
807 for (
__chunk_type* __p = this->_M_start._M_p; __p != this->_M_end_of_storage._M_data; ++__p)
814#if defined (_STLP_NO_BOOL) || defined (__HP_aCC)
815# define _STLP_TEMPLATE_HEADER __BVEC_TMPL_HEADER
816# define _STLP_TEMPLATE_CONTAINER __BVECTOR_QUALIFIED
818# undef _STLP_TEMPLATE_CONTAINER
819# undef _STLP_TEMPLATE_HEADER
822#if defined (_STLP_DEBUG) && !defined (_STLP_NO_BOOL)
830#undef _STLP_VECBOOL_TEMPLATE
832#undef __BVECTOR_QUALIFIED
833#undef __BVEC_TMPL_HEADER
#define random_access_iterator_tag
_STLP_INLINE_LOOP _InputIter __last
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
_BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first, _BidirectionalIter1 __last, _BidirectionalIter2 __result, const bidirectional_iterator_tag &, _Distance *)
_STLP_MOVE_TO_STD_NAMESPACE void fill_n(_OutputIter __first, _Size __n, const _Tp &__val)
_STLP_INLINE_LOOP _InputIter const _Tp & __val
#define _STLP_CONVERT_ALLOCATOR(__a, _Tp)
#define _STLP_FORCE_ALLOCATORS(a, y)
#define __BVEC_TMPL_HEADER
_STLP_MOVE_TO_STD_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE typedef _Bit_iter< bool, const bool * > _Bit_const_iterator
bool _STLP_CALL operator>(const _Bit_iterator_base &__x, const _Bit_iterator_base &__y)
bool _STLP_CALL operator!=(const _Bit_iterator_base &__x, const _Bit_iterator_base &__y)
bool _STLP_CALL operator>=(const _Bit_iterator_base &__x, const _Bit_iterator_base &__y)
bool _STLP_CALL operator==(const _Bit_iterator_base &__x, const _Bit_iterator_base &__y)
_Bit_iter< _Ref, _Ptr > _STLP_CALL operator+(ptrdiff_t __n, const _Bit_iter< _Ref, _Ptr > &__x)
bool _STLP_CALL operator<=(const _Bit_iterator_base &__x, const _Bit_iterator_base &__y)
bool _STLP_CALL operator<(const _Bit_iterator_base &__x, const _Bit_iterator_base &__y)
_Bit_iter< _Bit_reference, _Bit_reference * > _Bit_iterator
#define _STLP_ITERATOR_CATEGORY(_It, _Tp)
_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_range_error(const char *__msg)
_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_length_error(const char *__msg)
void get(int argc, const char *argv[])
unsigned int __chunk_type
_Bvector_base< _Alloc > _Self
_Bvector_base(__move_source< _Self > src)
__chunk_type * _M_bit_alloc(size_t __n)
_Alloc_traits< __chunk_type, _Alloc >::allocator_type __chunk_allocator_type
_Bvector_base(const allocator_type &__a)
static size_t _M_bits_to_chunks(size_t __n_bits)
allocator_type get_allocator() const
_STLP_alloc_proxy< __chunk_type *, __chunk_type, __chunk_allocator_type > _M_end_of_storage
_Tp * allocate(size_type __n, size_type &__allocated_n)
const_reference front() const
void insert(iterator __position, size_type __n, bool __x)
void _M_fill_insert(iterator __position, size_type __n, bool __x)
__BVECTOR(const bool *__first, const bool *__last, const allocator_type &__a=allocator_type())
_STLP_PRIV _Bvector_base< _Alloc >::allocator_type allocator_type
void _M_fill_assign(size_t __n, bool __x)
reference at(size_type __n)
_STLP_PRIV _Bvector_base< _Alloc > _Base
const_iterator end() const
_STLP_PRIV _Bvector_base< _Alloc >::__chunk_type __chunk_type
void _M_range_check(size_type __n) const
void assign(size_t __n, bool __x)
size_type capacity() const
_STLP_PRIV _Bit_const_iterator const_iterator
__BVECTOR(size_type __n, bool __val, const allocator_type &__a=allocator_type())
iterator erase(iterator __first, iterator __last)
__BVECTOR(const _Self &__x)
void swap(__BVECTOR_QUALIFIED &__x)
reference operator[](size_type __n)
const_iterator begin() const
void insert(iterator __position, const_iterator __first, const_iterator __last)
__BVECTOR(const_iterator __first, const_iterator __last, const allocator_type &__a=allocator_type())
const bool * const_pointer
const_reference at(size_type __n) const
_STLP_PRIV _Bit_reference * pointer
_STLP_PRIV _Bit_reference reference
void _M_insert_aux(iterator __position, bool __x)
__BVECTOR(const allocator_type &__a=allocator_type())
void reserve(size_type __n)
iterator erase(iterator __position)
const_reverse_iterator rbegin() const
random_access_iterator_tag _Iterator_category
const_reverse_iterator rend() const
__BVECTOR(__move_source< _Self > src)
const_reference operator[](size_type __n) const
size_type max_size() const
const_reference back() const
_STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS
_STLP_PRIV _Bit_iterator iterator
void resize(size_type __new_size, bool __x=bool())
reverse_iterator rbegin()
void insert(iterator __position, const bool *__first, const bool *__last)
__BVECTOR_QUALIFIED _Self
void _M_initialize(size_type __n)
ptrdiff_t difference_type
__BVECTOR_QUALIFIED & operator=(const __BVECTOR_QUALIFIED &__x)
iterator insert(iterator __position, bool __x=bool())
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
__kernel_ptrdiff_t ptrdiff_t
#define _STLP_TEMPLATE_NULL
#define _STLP_MOVE_TO_STD_NAMESPACE
#define __STATIC_CAST(__x, __y)
#define _STLP_ALLOCATOR_TYPE_DFL
#define _STLP_BEGIN_NAMESPACE
#define _STLP_END_NAMESPACE
#define _STLP_MOVE_TO_PRIV_NAMESPACE
_Bit_iter(const _Bit_iter< _Bit_reference, _Bit_reference * > &__x)
_Self operator+(difference_type __i) const
random_access_iterator_tag iterator_category
reference operator*() const
_Self & operator-=(difference_type __i)
_Self operator-(difference_type __i) const
_Bit_iter< _Ref, _Ptr > _Self
reference operator[](difference_type __i)
difference_type operator-(const _Self &__x) const
_Self & operator+=(difference_type __i)
ptrdiff_t difference_type
_Bit_iter(unsigned int *__x, unsigned int __y)
ptrdiff_t difference_type
_Bit_iterator_base(unsigned int *__x, unsigned int __y)
difference_type _M_subtract(const _Bit_iterator_base &__x) const
void _M_advance(difference_type __i)
_Bit_reference & operator|=(bool __x)
bool operator<(const _Bit_reference &__x) const
_Bit_reference(unsigned int *__x, unsigned int __y)
_Bit_reference & operator&=(bool __x)
bool operator==(const _Bit_reference &__x) const
_Bit_reference & operator=(bool __x)
__true_type has_trivial_copy_constructor
__false_type has_trivial_assignment_operator
__false_type has_trivial_default_constructor
__true_type has_trivial_destructor
__bool2type< pod >::_Ret is_POD_type
__bool2type< trivial_destructor >::_Ret has_trivial_destructor
__bool2type< trivial_constructor >::_Ret has_trivial_default_constructor
__bool2type< trivial_copy >::_Ret has_trivial_copy_constructor
__bool2type< trivial_assign >::_Ret has_trivial_assignment_operator