1.1 --- a/epoc32/include/stdapis/stlportv5/stl/_bvector.h Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_bvector.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -9,13 +9,13 @@
1.4 * Copyright (c) 1997
1.5 * Moscow Center for SPARC Technology
1.6 *
1.7 - * Copyright (c) 1999
1.8 + * Copyright (c) 1999
1.9 * Boris Fomitchev
1.10 *
1.11 * This material is provided "as is", with absolutely no warranty expressed
1.12 * or implied. Any use is at your own risk.
1.13 *
1.14 - * Permission to use or copy this software for any purpose is hereby granted
1.15 + * Permission to use or copy this software for any purpose is hereby granted
1.16 * without fee, provided the above notices are retained on all copies.
1.17 * Permission to modify the code and to distribute modified code is granted,
1.18 * provided the above notices are retained, and a notice that the code was
1.19 @@ -31,74 +31,83 @@
1.20 #define _STLP_INTERNAL_BVECTOR_H
1.21
1.22 #ifndef _STLP_INTERNAL_VECTOR_H
1.23 -# include <stl/_vector.h>
1.24 -# endif
1.25 -
1.26 -#ifndef __WORD_BIT
1.27 -#define __WORD_BIT (int(CHAR_BIT*sizeof(unsigned int)))
1.28 +# include <stl/_vector.h>
1.29 #endif
1.30
1.31 -_STLP_BEGIN_NAMESPACE
1.32 +#define _STLP_WORD_BIT (int(CHAR_BIT*sizeof(unsigned int)))
1.33 +
1.34 +_STLP_BEGIN_NAMESPACE
1.35 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.36
1.37 struct _Bit_reference {
1.38 unsigned int* _M_p;
1.39 unsigned int _M_mask;
1.40 - _Bit_reference(unsigned int* __x, unsigned int __y)
1.41 + _Bit_reference(unsigned int* __x, unsigned int __y)
1.42 : _M_p(__x), _M_mask(__y) {}
1.43
1.44 public:
1.45 _Bit_reference() : _M_p(0), _M_mask(0) {}
1.46
1.47 - operator bool() const {
1.48 - return !(!(*_M_p & _M_mask));
1.49 + operator bool() const {
1.50 + return !(!(*_M_p & _M_mask));
1.51 }
1.52 - _Bit_reference& operator=(bool __x) {
1.53 + _Bit_reference& operator = (bool __x) {
1.54 if (__x) *_M_p |= _M_mask;
1.55 else *_M_p &= ~_M_mask;
1.56 return *this;
1.57 }
1.58 - _Bit_reference& operator=(const _Bit_reference& __x) {
1.59 - return *this = bool(__x);
1.60 + _Bit_reference& operator = (const _Bit_reference& __x) {
1.61 + return *this = bool(__x);
1.62 }
1.63 - bool operator==(const _Bit_reference& __x) const {
1.64 - return bool(*this) == bool(__x);
1.65 + bool operator == (const _Bit_reference& __x) const {
1.66 + return bool(*this) == bool(__x);
1.67 }
1.68 - bool operator<(const _Bit_reference& __x) const {
1.69 + bool operator < (const _Bit_reference& __x) const {
1.70 return !bool(*this) && bool(__x);
1.71 }
1.72
1.73 _Bit_reference& operator |= (bool __x) {
1.74 - if (__x)
1.75 - *_M_p |= _M_mask;
1.76 - return *this;
1.77 + if (__x)
1.78 + *_M_p |= _M_mask;
1.79 + return *this;
1.80 }
1.81 _Bit_reference& operator &= (bool __x) {
1.82 - if (!__x)
1.83 - *_M_p &= ~_M_mask;
1.84 - return *this;
1.85 + if (!__x)
1.86 + *_M_p &= ~_M_mask;
1.87 + return *this;
1.88 }
1.89 void flip() { *_M_p ^= _M_mask; }
1.90 };
1.91
1.92
1.93 -inline void swap(_Bit_reference& __x, _Bit_reference& __y)
1.94 -{
1.95 +_STLP_MOVE_TO_STD_NAMESPACE
1.96 +
1.97 +inline void swap(_STLP_PRIV _Bit_reference& __x, _STLP_PRIV _Bit_reference& __y) {
1.98 bool __tmp = (bool)__x;
1.99 __x = __y;
1.100 __y = __tmp;
1.101 }
1.102
1.103 -struct _Bit_iterator_base;
1.104 +// Might not be very useful but costs nothing!
1.105 +_STLP_TEMPLATE_NULL
1.106 +struct __type_traits<_STLP_PRIV _Bit_reference> {
1.107 + typedef __false_type has_trivial_default_constructor;
1.108 + typedef __true_type has_trivial_copy_constructor;
1.109 + typedef __false_type has_trivial_assignment_operator;
1.110 + typedef __true_type has_trivial_destructor;
1.111 + typedef __false_type is_POD_type;
1.112 +};
1.113
1.114 -struct _Bit_iterator_base
1.115 -{
1.116 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.117 +
1.118 +struct _Bit_iterator_base {
1.119 typedef ptrdiff_t difference_type;
1.120
1.121 unsigned int* _M_p;
1.122 unsigned int _M_offset;
1.123
1.124 void _M_bump_up() {
1.125 - if (_M_offset++ == __WORD_BIT - 1) {
1.126 + if (_M_offset++ == _STLP_WORD_BIT - 1) {
1.127 _M_offset = 0;
1.128 ++_M_p;
1.129 }
1.130 @@ -106,29 +115,32 @@
1.131
1.132 void _M_bump_down() {
1.133 if (_M_offset-- == 0) {
1.134 - _M_offset = __WORD_BIT - 1;
1.135 + _M_offset = _STLP_WORD_BIT - 1;
1.136 --_M_p;
1.137 }
1.138 }
1.139
1.140 _Bit_iterator_base() : _M_p(0), _M_offset(0) {}
1.141 _Bit_iterator_base(unsigned int* __x, unsigned int __y) : _M_p(__x), _M_offset(__y) {}
1.142 - // _Bit_iterator_base( const _Bit_iterator_base& __x) : _M_p(__x._M_p), _M_offset(__x._M_offset) {}
1.143 +// see comment in doc/README.evc4 and doc/README.evc8
1.144 +#if defined(_MSC_VER) && _MSC_VER<=1401 && defined(MIPS) && defined(NDEBUG)
1.145 + _Bit_iterator_base( const _Bit_iterator_base& __x) : _M_p(__x._M_p), _M_offset(__x._M_offset) {}
1.146 +#endif
1.147 // _Bit_iterator_base& operator = ( const _Bit_iterator_base& __x) { _M_p = __x._M_p ; _M_offset = __x._M_offset ; return *this; }
1.148
1.149 void _M_advance (difference_type __i) {
1.150 difference_type __n = __i + _M_offset;
1.151 - _M_p += __n / __WORD_BIT;
1.152 - __n = __n % __WORD_BIT;
1.153 + _M_p += __n / _STLP_WORD_BIT;
1.154 + __n = __n % _STLP_WORD_BIT;
1.155 if (__n < 0) {
1.156 - _M_offset = (unsigned int) __n + __WORD_BIT;
1.157 + _M_offset = (unsigned int) __n + _STLP_WORD_BIT;
1.158 --_M_p;
1.159 } else
1.160 _M_offset = (unsigned int) __n;
1.161 }
1.162
1.163 difference_type _M_subtract(const _Bit_iterator_base& __x) const {
1.164 - return __WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset;
1.165 + return _STLP_WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset;
1.166 }
1.167 };
1.168
1.169 @@ -143,19 +155,18 @@
1.170 return __x._M_p < __y._M_p || (__x._M_p == __y._M_p && __x._M_offset < __y._M_offset);
1.171 }
1.172
1.173 -inline bool _STLP_CALL operator>(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
1.174 - return operator <(__y , __x);
1.175 +inline bool _STLP_CALL operator>(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
1.176 + return operator <(__y , __x);
1.177 }
1.178 -inline bool _STLP_CALL operator<=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
1.179 - return !(__y < __x);
1.180 +inline bool _STLP_CALL operator<=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
1.181 + return !(__y < __x);
1.182 }
1.183 -inline bool _STLP_CALL operator>=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
1.184 - return !(__x < __y);
1.185 +inline bool _STLP_CALL operator>=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
1.186 + return !(__x < __y);
1.187 }
1.188
1.189 template <class _Ref, class _Ptr>
1.190 -struct _Bit_iter : public _Bit_iterator_base
1.191 -{
1.192 +struct _Bit_iter : public _Bit_iterator_base {
1.193 typedef _Ref reference;
1.194 typedef _Ptr pointer;
1.195 typedef _Bit_iter<_Ref, _Ptr> _Self;
1.196 @@ -167,14 +178,14 @@
1.197 _Bit_iter(unsigned int* __x, unsigned int __y) : _Bit_iterator_base(__x, __y) {}
1.198 _Bit_iter() {}
1.199
1.200 - _Bit_iter(const _Bit_iter<_Bit_reference, _Bit_reference*>& __x):
1.201 + _Bit_iter(const _Bit_iter<_Bit_reference, _Bit_reference*>& __x):
1.202 _Bit_iterator_base((const _Bit_iterator_base&)__x) {}
1.203
1.204 // _Self& operator = (const _Bit_iter<_Bit_reference, _Bit_reference*>& __x)
1.205 // { (_Bit_iterator_base&)*this = (const _Bit_iterator_base&)__x; return *this; }
1.206
1.207 - reference operator*() const {
1.208 - return _Bit_reference(_M_p, 1UL << _M_offset);
1.209 + reference operator*() const {
1.210 + return _Bit_reference(_M_p, 1UL << _M_offset);
1.211 }
1.212 _Self& operator++() {
1.213 _M_bump_up();
1.214 @@ -222,173 +233,195 @@
1.215 return __x + __n;
1.216 }
1.217
1.218 -# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES
1.219 -inline random_access_iterator_tag iterator_category(const _Bit_iterator_base&) {return random_access_iterator_tag();}
1.220 -inline ptrdiff_t* distance_type(const _Bit_iterator_base&) {return (ptrdiff_t*)0;}
1.221 -inline bool* value_type(const _Bit_iter<_Bit_reference, _Bit_reference*>&) {return (bool*)0;}
1.222 -inline bool* value_type(const _Bit_iter<bool, const bool*>&) {return (bool*)0;}
1.223 -# endif
1.224 +_STLP_MOVE_TO_STD_NAMESPACE
1.225 +
1.226 +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
1.227 +template <class _Ref, class _Ptr>
1.228 +struct __type_traits< _STLP_PRIV _Bit_iter<_Ref, _Ptr> > {
1.229 + typedef __false_type has_trivial_default_constructor;
1.230 + typedef __true_type has_trivial_copy_constructor;
1.231 + typedef __true_type has_trivial_assignment_operator;
1.232 + typedef __true_type has_trivial_destructor;
1.233 + typedef __false_type is_POD_type;
1.234 +};
1.235 +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
1.236 +
1.237 +#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
1.238 +inline random_access_iterator_tag iterator_category(const _STLP_PRIV _Bit_iterator_base&)
1.239 +{ return random_access_iterator_tag(); }
1.240 +inline ptrdiff_t* distance_type(const _STLP_PRIV _Bit_iterator_base&)
1.241 +{ return (ptrdiff_t*)0; }
1.242 +inline bool* value_type(const _STLP_PRIV _Bit_iter<_STLP_PRIV _Bit_reference, _STLP_PRIV _Bit_reference*>&)
1.243 +{ return (bool*)0; }
1.244 +inline bool* value_type(const _STLP_PRIV _Bit_iter<bool, const bool*>&)
1.245 +{ return (bool*)0; }
1.246 +#endif
1.247 +
1.248 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.249
1.250 typedef _Bit_iter<bool, const bool*> _Bit_const_iterator;
1.251 typedef _Bit_iter<_Bit_reference, _Bit_reference*> _Bit_iterator;
1.252
1.253 // Bit-vector base class, which encapsulates the difference between
1.254 // old SGI-style allocators and standard-conforming allocators.
1.255 -
1.256 -
1.257 template <class _Alloc>
1.258 -class _Bvector_base
1.259 -{
1.260 +class _Bvector_base {
1.261 + typedef _Bvector_base<_Alloc> _Self;
1.262 public:
1.263 _STLP_FORCE_ALLOCATORS(bool, _Alloc)
1.264 typedef typename _Alloc_traits<bool, _Alloc>::allocator_type allocator_type;
1.265 typedef unsigned int __chunk_type;
1.266 - typedef typename _Alloc_traits<__chunk_type,
1.267 + typedef typename _Alloc_traits<__chunk_type,
1.268 _Alloc>::allocator_type __chunk_allocator_type;
1.269 - allocator_type get_allocator() const {
1.270 - return _STLP_CONVERT_ALLOCATOR((const __chunk_allocator_type&)_M_end_of_storage, bool);
1.271 + allocator_type get_allocator() const {
1.272 + return _STLP_CONVERT_ALLOCATOR((const __chunk_allocator_type&)_M_end_of_storage, bool);
1.273 }
1.274 static allocator_type __get_dfl_allocator() { return allocator_type(); }
1.275 -
1.276 +
1.277 _Bvector_base(const allocator_type& __a)
1.278 : _M_start(), _M_finish(), _M_end_of_storage(_STLP_CONVERT_ALLOCATOR(__a, __chunk_type),
1.279 - (__chunk_type*)0) {
1.280 + (__chunk_type*)0)
1.281 + {}
1.282 + _Bvector_base(__move_source<_Self> src)
1.283 + : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
1.284 + _M_end_of_storage(src.get()._M_end_of_storage) {
1.285 + //Make the source destroyable
1.286 + src.get()._M_start._M_p = 0;
1.287 }
1.288 - ~_Bvector_base() { _M_deallocate();
1.289 +
1.290 + ~_Bvector_base() {
1.291 + _M_deallocate();
1.292 }
1.293
1.294 protected:
1.295
1.296 - unsigned int* _M_bit_alloc(size_t __n)
1.297 - { return _M_end_of_storage.allocate((__n + __WORD_BIT - 1)/__WORD_BIT); }
1.298 + unsigned int* _M_bit_alloc(size_t __n) {
1.299 + return _M_end_of_storage.allocate((__n + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT);
1.300 + }
1.301 void _M_deallocate() {
1.302 if (_M_start._M_p)
1.303 _M_end_of_storage.deallocate(_M_start._M_p,
1.304 - _M_end_of_storage._M_data - _M_start._M_p);
1.305 + _M_end_of_storage._M_data - _M_start._M_p);
1.306 }
1.307
1.308 _Bit_iterator _M_start;
1.309 _Bit_iterator _M_finish;
1.310 - _STLP_alloc_proxy<__chunk_type*, __chunk_type, __chunk_allocator_type> _M_end_of_storage;
1.311 + _STLP_alloc_proxy<__chunk_type*, __chunk_type, __chunk_allocator_type> _M_end_of_storage;
1.312 };
1.313
1.314
1.315 // The next few lines are confusing. What we're doing is declaring a
1.316 // partial specialization of vector<T, Alloc> if we have the necessary
1.317 // compiler support. Otherwise, we define a class bit_vector which uses
1.318 -// the default allocator.
1.319 +// the default allocator.
1.320
1.321 -#if defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) && ! defined(_STLP_NO_BOOL) && ! defined (__SUNPRO_CC)
1.322 -# define _STLP_VECBOOL_TEMPLATE
1.323 -# define __BVEC_TMPL_HEADER template <class _Alloc>
1.324 +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_BOOL) && !defined (__SUNPRO_CC)
1.325 +# define _STLP_VECBOOL_TEMPLATE
1.326 +# define __BVEC_TMPL_HEADER template <class _Alloc>
1.327 #else
1.328 -# undef _STLP_VECBOOL_TEMPLATE
1.329 -# ifdef _STLP_NO_BOOL
1.330 -# define __BVEC_TMPL_HEADER
1.331 -# else
1.332 -# define __BVEC_TMPL_HEADER _STLP_TEMPLATE_NULL
1.333 -# endif
1.334 -# if !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__))) //*TY 12/17/2000 -
1.335 -# define _Alloc _STLP_DEFAULT_ALLOCATOR(bool)
1.336 -# else
1.337 -# define _Alloc allocator<bool>
1.338 -# endif
1.339 +# undef _STLP_VECBOOL_TEMPLATE
1.340 +# ifdef _STLP_NO_BOOL
1.341 +# define __BVEC_TMPL_HEADER
1.342 +# else
1.343 +# define __BVEC_TMPL_HEADER _STLP_TEMPLATE_NULL
1.344 +# endif
1.345 +# if !(defined(__MRC__)||(defined(__SC__)&&!defined(__DMC__))) //*TY 12/17/2000 -
1.346 +# define _Alloc _STLP_DEFAULT_ALLOCATOR(bool)
1.347 +# else
1.348 +# define _Alloc allocator<bool>
1.349 +# endif
1.350 +#endif
1.351 +
1.352 +#if defined (_STLP_DEBUG)
1.353 +# define vector _STLP_NON_DBG_NAME(vector)
1.354 #endif
1.355
1.356 #ifdef _STLP_NO_BOOL
1.357 -# define __BVECTOR_QUALIFIED bit_vector
1.358 -# define __BVECTOR bit_vector
1.359 +# define __BVECTOR_QUALIFIED bit_vector
1.360 +# define __BVECTOR bit_vector
1.361 #else
1.362 -# ifdef _STLP_VECBOOL_TEMPLATE
1.363 -# define __BVECTOR_QUALIFIED __WORKAROUND_DBG_RENAME(vector) <bool, _Alloc>
1.364 -# else
1.365 -# define __BVECTOR_QUALIFIED __WORKAROUND_DBG_RENAME(vector) <bool, allocator<bool> >
1.366 -# endif
1.367 -#if defined (_STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS)
1.368 -# define __BVECTOR __BVECTOR_QUALIFIED
1.369 -#else
1.370 -# define __BVECTOR __WORKAROUND_DBG_RENAME(vector)
1.371 -#endif
1.372 +# ifdef _STLP_VECBOOL_TEMPLATE
1.373 +# define __BVECTOR_QUALIFIED vector<bool, _Alloc>
1.374 +# else
1.375 +# define __BVECTOR_QUALIFIED vector<bool, allocator<bool> >
1.376 +# endif
1.377 +# if defined (_STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS)
1.378 +# define __BVECTOR __BVECTOR_QUALIFIED
1.379 +# else
1.380 +# define __BVECTOR vector
1.381 +# endif
1.382 #endif
1.383
1.384 +#if !defined (_STLP_DEBUG) || defined (_STLP_NO_BOOL)
1.385 +_STLP_MOVE_TO_STD_NAMESPACE
1.386 +#endif
1.387
1.388 __BVEC_TMPL_HEADER
1.389 -class __BVECTOR_QUALIFIED : public _Bvector_base<_Alloc >
1.390 +class __BVECTOR_QUALIFIED : public _STLP_PRIV _Bvector_base<_Alloc >
1.391 +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_DEBUG)
1.392 + , public __stlport_class< __BVECTOR_QUALIFIED >
1.393 +#endif
1.394 {
1.395 - typedef _Bvector_base<_Alloc > _Base;
1.396 + typedef _STLP_PRIV _Bvector_base<_Alloc > _Base;
1.397 typedef __BVECTOR_QUALIFIED _Self;
1.398 public:
1.399 typedef bool value_type;
1.400 typedef size_t size_type;
1.401 - typedef ptrdiff_t difference_type;
1.402 - typedef _Bit_reference reference;
1.403 + typedef ptrdiff_t difference_type;
1.404 + typedef _STLP_PRIV _Bit_reference reference;
1.405 typedef bool const_reference;
1.406 - typedef _Bit_reference* pointer;
1.407 + typedef _STLP_PRIV _Bit_reference* pointer;
1.408 typedef const bool* const_pointer;
1.409 typedef random_access_iterator_tag _Iterator_category;
1.410
1.411 - typedef _Bit_iterator iterator;
1.412 - typedef _Bit_const_iterator const_iterator;
1.413 + typedef _STLP_PRIV _Bit_iterator iterator;
1.414 + typedef _STLP_PRIV _Bit_const_iterator const_iterator;
1.415
1.416 -#if defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION )
1.417 - typedef _STLP_STD::reverse_iterator<const_iterator> const_reverse_iterator;
1.418 - typedef _STLP_STD::reverse_iterator<iterator> reverse_iterator;
1.419 -#else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
1.420 -# if defined (_STLP_MSVC50_COMPATIBILITY)
1.421 - typedef _STLP_STD::reverse_iterator<const_iterator, value_type, const_reference,
1.422 - const_pointer, difference_type> const_reverse_iterator;
1.423 - typedef _STLP_STD::reverse_iterator<iterator, value_type, reference, reference*,
1.424 - difference_type> reverse_iterator;
1.425 -# else
1.426 - typedef _STLP_STD::reverse_iterator<const_iterator, value_type, const_reference,
1.427 - difference_type> const_reverse_iterator;
1.428 - typedef _STLP_STD::reverse_iterator<iterator, value_type, reference, difference_type>
1.429 - reverse_iterator;
1.430 -# endif
1.431 -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
1.432 + _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
1.433
1.434 -# ifdef _STLP_VECBOOL_TEMPLATE
1.435 - typedef typename _Bvector_base<_Alloc >::allocator_type allocator_type;
1.436 - typedef typename _Bvector_base<_Alloc >::__chunk_type __chunk_type ;
1.437 -# else
1.438 - typedef _Bvector_base<_Alloc >::allocator_type allocator_type;
1.439 - typedef _Bvector_base<_Alloc >::__chunk_type __chunk_type ;
1.440 -# endif
1.441 +#ifdef _STLP_VECBOOL_TEMPLATE
1.442 + typedef typename _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type;
1.443 + typedef typename _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type;
1.444 +#else
1.445 + typedef _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type;
1.446 + typedef _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type;
1.447 +#endif
1.448
1.449 protected:
1.450
1.451 void _M_initialize(size_type __n) {
1.452 unsigned int* __q = this->_M_bit_alloc(__n);
1.453 - this->_M_end_of_storage._M_data = __q + (__n + __WORD_BIT - 1)/__WORD_BIT;
1.454 + this->_M_end_of_storage._M_data = __q + (__n + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
1.455 this->_M_start = iterator(__q, 0);
1.456 this->_M_finish = this->_M_start + difference_type(__n);
1.457 }
1.458 void _M_insert_aux(iterator __position, bool __x) {
1.459 if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) {
1.460 - __copy_backward(__position, this->_M_finish, this->_M_finish + 1, random_access_iterator_tag(), (difference_type*)0 );
1.461 + _STLP_PRIV __copy_backward(__position, this->_M_finish, this->_M_finish + 1,
1.462 + random_access_iterator_tag(), (difference_type*)0 );
1.463 *__position = __x;
1.464 ++this->_M_finish;
1.465 }
1.466 else {
1.467 - size_type __len = size() ? 2 * size() : __WORD_BIT;
1.468 + size_type __len = size() ? 2 * size() : _STLP_WORD_BIT;
1.469 unsigned int* __q = this->_M_bit_alloc(__len);
1.470 iterator __i = copy(begin(), __position, iterator(__q, 0));
1.471 *__i++ = __x;
1.472 this->_M_finish = copy(__position, end(), __i);
1.473 this->_M_deallocate();
1.474 - this->_M_end_of_storage._M_data = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
1.475 + this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
1.476 this->_M_start = iterator(__q, 0);
1.477 }
1.478 }
1.479
1.480 -#ifdef _STLP_MEMBER_TEMPLATES
1.481 +#if defined (_STLP_MEMBER_TEMPLATES)
1.482 template <class _InputIterator>
1.483 void _M_initialize_range(_InputIterator __first, _InputIterator __last,
1.484 - const input_iterator_tag &) {
1.485 + const input_iterator_tag &) {
1.486 this->_M_start = iterator();
1.487 this->_M_finish = iterator();
1.488 this->_M_end_of_storage._M_data = 0;
1.489 - for ( ; __first != __last; ++__first)
1.490 + for ( ; __first != __last; ++__first)
1.491 push_back(*__first);
1.492 }
1.493
1.494 @@ -397,8 +430,7 @@
1.495 const forward_iterator_tag &) {
1.496 size_type __n = distance(__first, __last);
1.497 _M_initialize(__n);
1.498 - // copy(__first, __last, _M_start);
1.499 - copy(__first, __last, this->_M_start); // dwa 12/22/99 -- resolving ambiguous reference.
1.500 + copy(__first, __last, this->_M_start);
1.501 }
1.502
1.503 template <class _InputIterator>
1.504 @@ -418,7 +450,8 @@
1.505 if (__first != __last) {
1.506 size_type __n = distance(__first, __last);
1.507 if (capacity() - size() >= __n) {
1.508 - __copy_backward(__position, end(), this->_M_finish + difference_type(__n), random_access_iterator_tag(), (difference_type*)0 );
1.509 + _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n),
1.510 + random_access_iterator_tag(), (difference_type*)0 );
1.511 copy(__first, __last, __position);
1.512 this->_M_finish += difference_type(__n);
1.513 }
1.514 @@ -429,11 +462,11 @@
1.515 __i = copy(__first, __last, __i);
1.516 this->_M_finish = copy(__position, end(), __i);
1.517 this->_M_deallocate();
1.518 - this->_M_end_of_storage._M_data = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
1.519 + this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
1.520 this->_M_start = iterator(__q, 0);
1.521 }
1.522 }
1.523 - }
1.524 + }
1.525
1.526 #endif /* _STLP_MEMBER_TEMPLATES */
1.527
1.528 @@ -444,12 +477,12 @@
1.529 const_iterator end() const { return this->_M_finish; }
1.530
1.531 reverse_iterator rbegin() { return reverse_iterator(end()); }
1.532 - const_reverse_iterator rbegin() const {
1.533 - return const_reverse_iterator(end());
1.534 + const_reverse_iterator rbegin() const {
1.535 + return const_reverse_iterator(end());
1.536 }
1.537 reverse_iterator rend() { return reverse_iterator(begin()); }
1.538 - const_reverse_iterator rend() const {
1.539 - return const_reverse_iterator(begin());
1.540 + const_reverse_iterator rend() const {
1.541 + return const_reverse_iterator(begin());
1.542 }
1.543
1.544 size_type size() const { return size_type(end() - begin()); }
1.545 @@ -458,9 +491,9 @@
1.546 return size_type(const_iterator(this->_M_end_of_storage._M_data, 0) - begin());
1.547 }
1.548 bool empty() const { return begin() == end(); }
1.549 - reference operator[](size_type __n)
1.550 + reference operator[](size_type __n)
1.551 { return *(begin() + difference_type(__n)); }
1.552 - const_reference operator[](size_type __n) const
1.553 + const_reference operator[](size_type __n) const
1.554 { return *(begin() + difference_type(__n)); }
1.555
1.556 void _M_range_check(size_type __n) const {
1.557 @@ -474,35 +507,25 @@
1.558 { _M_range_check(__n); return (*this)[__n]; }
1.559
1.560 explicit __BVECTOR(const allocator_type& __a = allocator_type())
1.561 - : _Bvector_base<_Alloc >(__a) {
1.562 - _STLP_POP_IF_CHECK
1.563 - }
1.564 + : _STLP_PRIV _Bvector_base<_Alloc >(__a) {}
1.565
1.566 __BVECTOR(size_type __n, bool __val,
1.567 - const allocator_type& __a =
1.568 - allocator_type())
1.569 - : _Bvector_base<_Alloc >(__a)
1.570 - {
1.571 - _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.572 + const allocator_type& __a = allocator_type())
1.573 + : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
1.574 _M_initialize(__n);
1.575 fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __val ? ~0 : 0);
1.576 - _STLP_POP_CLEANUP_ITEM
1.577 }
1.578
1.579 explicit __BVECTOR(size_type __n)
1.580 - : _Bvector_base<_Alloc >(allocator_type())
1.581 - {
1.582 - _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.583 + : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) {
1.584 _M_initialize(__n);
1.585 fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), 0);
1.586 - _STLP_POP_CLEANUP_ITEM
1.587 }
1.588
1.589 - __BVECTOR(const _Self& __x) : _Bvector_base<_Alloc >(__x.get_allocator()) {
1.590 - _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.591 + __BVECTOR(const _Self& __x)
1.592 + : _STLP_PRIV _Bvector_base<_Alloc >(__x.get_allocator()) {
1.593 _M_initialize(__x.size());
1.594 copy(__x.begin(), __x.end(), this->_M_start);
1.595 - _STLP_POP_CLEANUP_ITEM
1.596 }
1.597
1.598 #if defined (_STLP_MEMBER_TEMPLATES)
1.599 @@ -511,58 +534,49 @@
1.600 _M_initialize(__n);
1.601 fill(this->_M_start._M_p, this->_M_end_of_storage._M_data, __x ? ~0 : 0);
1.602 }
1.603 -
1.604 +
1.605 template <class _InputIterator>
1.606 void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
1.607 const __false_type&) {
1.608 _M_initialize_range(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
1.609 }
1.610 -# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS
1.611 +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
1.612 // Check whether it's an integral type. If so, it's not an iterator.
1.613 template <class _InputIterator>
1.614 __BVECTOR(_InputIterator __first, _InputIterator __last)
1.615 - : _Base(allocator_type())
1.616 - {
1.617 - typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
1.618 - _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.619 + : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) {
1.620 + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
1.621 _M_initialize_dispatch(__first, __last, _Integral());
1.622 - _STLP_POP_CLEANUP_ITEM
1.623 }
1.624 -# endif
1.625 +# endif
1.626 template <class _InputIterator>
1.627 __BVECTOR(_InputIterator __first, _InputIterator __last,
1.628 const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
1.629 - : _Base(__a)
1.630 - {
1.631 - typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
1.632 - _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.633 + : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
1.634 + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
1.635 _M_initialize_dispatch(__first, __last, _Integral());
1.636 - _STLP_POP_CLEANUP_ITEM
1.637 }
1.638 #else /* _STLP_MEMBER_TEMPLATES */
1.639 __BVECTOR(const_iterator __first, const_iterator __last,
1.640 const allocator_type& __a = allocator_type())
1.641 - : _Bvector_base<_Alloc >(__a)
1.642 - {
1.643 - _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.644 + : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
1.645 size_type __n = distance(__first, __last);
1.646 _M_initialize(__n);
1.647 copy(__first, __last, this->_M_start);
1.648 - _STLP_POP_CLEANUP_ITEM
1.649 }
1.650 __BVECTOR(const bool* __first, const bool* __last,
1.651 const allocator_type& __a = allocator_type())
1.652 - : _Bvector_base<_Alloc >(__a)
1.653 - {
1.654 + : _STLP_PRIV _Bvector_base<_Alloc >(__a) {
1.655 size_type __n = distance(__first, __last);
1.656 - _STLP_PUSH_CLEANUP_ITEM(_Base, this)
1.657 _M_initialize(__n);
1.658 copy(__first, __last, this->_M_start);
1.659 - _STLP_POP_CLEANUP_ITEM
1.660 }
1.661 #endif /* _STLP_MEMBER_TEMPLATES */
1.662
1.663 - ~__BVECTOR() { }
1.664 + __BVECTOR(__move_source<_Self> src)
1.665 + : _STLP_PRIV _Bvector_base<_Alloc >(__move_source<_Base>(src.get())) {}
1.666 +
1.667 + ~__BVECTOR() {}
1.668
1.669 __BVECTOR_QUALIFIED& operator=(const __BVECTOR_QUALIFIED& __x) {
1.670 if (&__x == this) return *this;
1.671 @@ -575,12 +589,6 @@
1.672 return *this;
1.673 }
1.674
1.675 -#ifdef _STLP_USE_TRAP_LEAVE
1.676 -public:
1.677 - static void* operator new (size_t __n, TLeave) { return _STLP_StackHelper<bool>::_NewLC(__n); }
1.678 - static void* operator new (size_t __n) { return _STLP_StackHelper<bool>::_NewLC(__n); }
1.679 -#endif
1.680 -
1.681 // assign(), a generalized assignment member function. Two
1.682 // versions: one that takes a count, and one that takes a range.
1.683 // The range version is a member template, so we dispatch on whether
1.684 @@ -598,11 +606,10 @@
1.685 }
1.686 void assign(size_t __n, bool __x) { _M_fill_assign(__n, __x); }
1.687
1.688 -#ifdef _STLP_MEMBER_TEMPLATES
1.689 -
1.690 +#if defined (_STLP_MEMBER_TEMPLATES)
1.691 template <class _InputIterator>
1.692 void assign(_InputIterator __first, _InputIterator __last) {
1.693 - typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
1.694 + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
1.695 _M_assign_dispatch(__first, __last, _Integral());
1.696 }
1.697
1.698 @@ -638,18 +645,19 @@
1.699 copy(__first, __mid, begin());
1.700 insert(end(), __mid, __last);
1.701 }
1.702 - }
1.703 -
1.704 + }
1.705 #endif /* _STLP_MEMBER_TEMPLATES */
1.706
1.707 void reserve(size_type __n) {
1.708 if (capacity() < __n) {
1.709 + if (max_size() < __n)
1.710 + __stl_throw_length_error("vector<bool>");
1.711 unsigned int* __q = this->_M_bit_alloc(__n);
1.712 - _Bit_iterator __z(__q, 0);
1.713 + _STLP_PRIV _Bit_iterator __z(__q, 0);
1.714 this->_M_finish = copy(begin(), end(), __z);
1.715 this->_M_deallocate();
1.716 this->_M_start = iterator(__q, 0);
1.717 - this->_M_end_of_storage._M_data = __q + (__n + __WORD_BIT - 1)/__WORD_BIT;
1.718 + this->_M_end_of_storage._M_data = __q + (__n + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
1.719 }
1.720 }
1.721
1.722 @@ -668,7 +676,7 @@
1.723 void swap(__BVECTOR_QUALIFIED& __x) {
1.724 _STLP_STD::swap(this->_M_start, __x._M_start);
1.725 _STLP_STD::swap(this->_M_finish, __x._M_finish);
1.726 - _STLP_STD::swap(this->_M_end_of_storage, __x._M_end_of_storage);
1.727 + this->_M_end_of_storage.swap(__x._M_end_of_storage);
1.728 }
1.729 iterator insert(iterator __position, bool __x = bool()) {
1.730 difference_type __n = __position - begin();
1.731 @@ -681,7 +689,7 @@
1.732 return begin() + __n;
1.733 }
1.734
1.735 -#if defined ( _STLP_MEMBER_TEMPLATES )
1.736 +#if defined (_STLP_MEMBER_TEMPLATES)
1.737
1.738 template <class _Integer>
1.739 void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
1.740 @@ -700,8 +708,8 @@
1.741 template <class _InputIterator>
1.742 void insert(iterator __position,
1.743 _InputIterator __first, _InputIterator __last) {
1.744 - typedef typename _Is_integer<_InputIterator>::_Integral _Is_Integral;
1.745 - _M_insert_dispatch(__position, __first, __last, _Is_Integral());
1.746 + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
1.747 + _M_insert_dispatch(__position, __first, __last, _Integral());
1.748 }
1.749 #else /* _STLP_MEMBER_TEMPLATES */
1.750 void insert(iterator __position,
1.751 @@ -709,8 +717,8 @@
1.752 if (__first == __last) return;
1.753 size_type __n = distance(__first, __last);
1.754 if (capacity() - size() >= __n) {
1.755 - __copy_backward(__position, end(), this->_M_finish + __n,
1.756 - random_access_iterator_tag(), (difference_type*)0 );
1.757 + _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n,
1.758 + random_access_iterator_tag(), (difference_type*)0 );
1.759 copy(__first, __last, __position);
1.760 this->_M_finish += __n;
1.761 }
1.762 @@ -721,7 +729,7 @@
1.763 __i = copy(__first, __last, __i);
1.764 this->_M_finish = copy(__position, end(), __i);
1.765 this->_M_deallocate();
1.766 - this->_M_end_of_storage._M_data = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
1.767 + this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
1.768 this->_M_start = iterator(__q, 0);
1.769 }
1.770 }
1.771 @@ -730,8 +738,8 @@
1.772 if (__first == __last) return;
1.773 size_type __n = distance(__first, __last);
1.774 if (capacity() - size() >= __n) {
1.775 - __copy_backward(__position, end(), this->_M_finish + __n,
1.776 - random_access_iterator_tag(), (difference_type*)0 );
1.777 + _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n,
1.778 + random_access_iterator_tag(), (difference_type*)0 );
1.779 copy(__first, __last, __position);
1.780 this->_M_finish += __n;
1.781 }
1.782 @@ -742,16 +750,17 @@
1.783 __i = copy(__first, __last, __i);
1.784 this->_M_finish = copy(__position, end(), __i);
1.785 this->_M_deallocate();
1.786 - this->_M_end_of_storage._M_data = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
1.787 + this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
1.788 this->_M_start = iterator(__q, 0);
1.789 }
1.790 }
1.791 #endif /* _STLP_MEMBER_TEMPLATES */
1.792 -
1.793 +
1.794 void _M_fill_insert(iterator __position, size_type __n, bool __x) {
1.795 if (__n == 0) return;
1.796 if (capacity() - size() >= __n) {
1.797 - __copy_backward(__position, end(), this->_M_finish + difference_type(__n), random_access_iterator_tag(), (difference_type*)0 );
1.798 + _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n),
1.799 + random_access_iterator_tag(), (difference_type*)0 );
1.800 fill(__position, __position + difference_type(__n), __x);
1.801 this->_M_finish += difference_type(__n);
1.802 }
1.803 @@ -762,7 +771,7 @@
1.804 fill_n(__i, __n, __x);
1.805 this->_M_finish = copy(__position, end(), __i + difference_type(__n));
1.806 this->_M_deallocate();
1.807 - this->_M_end_of_storage._M_data = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
1.808 + this->_M_end_of_storage._M_data = __q + (__len + _STLP_WORD_BIT - 1)/_STLP_WORD_BIT;
1.809 this->_M_start = iterator(__q, 0);
1.810 }
1.811 }
1.812 @@ -772,7 +781,7 @@
1.813 }
1.814
1.815 void pop_back() {
1.816 - --this->_M_finish;
1.817 + --this->_M_finish;
1.818 }
1.819 iterator erase(iterator __position) {
1.820 if (__position + 1 != end())
1.821 @@ -785,7 +794,7 @@
1.822 return __first;
1.823 }
1.824 void resize(size_type __new_size, bool __x = bool()) {
1.825 - if (__new_size < size())
1.826 + if (__new_size < size())
1.827 erase(begin() + difference_type(__new_size), end());
1.828 else
1.829 insert(end(), __new_size - size(), __x);
1.830 @@ -798,34 +807,31 @@
1.831 void clear() { erase(begin(), end()); }
1.832 };
1.833
1.834 -# if defined ( _STLP_NO_BOOL ) || defined (__HP_aCC) // fixed soon (03/17/2000)
1.835 -
1.836 -#define _STLP_TEMPLATE_HEADER __BVEC_TMPL_HEADER
1.837 -#define _STLP_TEMPLATE_CONTAINER __BVECTOR_QUALIFIED
1.838 -#include <stl/_relops_cont.h>
1.839 -#undef _STLP_TEMPLATE_CONTAINER
1.840 -#undef _STLP_TEMPLATE_HEADER
1.841 -
1.842 -# endif /* NO_BOOL */
1.843 -
1.844 -#if !defined (_STLP_NO_BOOL)
1.845 -// This typedef is non-standard. It is provided for backward compatibility.
1.846 - typedef __WORKAROUND_DBG_RENAME(vector) <bool, allocator<bool> > bit_vector;
1.847 +#if defined (_STLP_NO_BOOL) || defined (__HP_aCC) // fixed soon (03/17/2000)
1.848 +# define _STLP_TEMPLATE_HEADER __BVEC_TMPL_HEADER
1.849 +# define _STLP_TEMPLATE_CONTAINER __BVECTOR_QUALIFIED
1.850 +# include <stl/_relops_cont.h>
1.851 +# undef _STLP_TEMPLATE_CONTAINER
1.852 +# undef _STLP_TEMPLATE_HEADER
1.853 +#endif /* NO_BOOL */
1.854 +
1.855 +#if defined (_STLP_DEBUG) && !defined (_STLP_NO_BOOL)
1.856 +_STLP_MOVE_TO_STD_NAMESPACE
1.857 #endif
1.858
1.859 _STLP_END_NAMESPACE
1.860
1.861 +#undef vector
1.862 #undef _Alloc
1.863 #undef _STLP_VECBOOL_TEMPLATE
1.864 #undef __BVECTOR
1.865 #undef __BVECTOR_QUALIFIED
1.866 #undef __BVEC_TMPL_HEADER
1.867
1.868 -# undef __WORD_BIT
1.869 +#undef _STLP_WORD_BIT
1.870
1.871 #endif /* _STLP_INTERNAL_BVECTOR_H */
1.872
1.873 // Local Variables:
1.874 // mode:C++
1.875 // End:
1.876 -