gccxml_gem 0.9.3-x86-darwin-11
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +84 -0
- data/bin/gccxml +0 -0
- data/bin/gccxml_cc1plus +0 -0
- data/gccxml.rb +57 -0
- data/share/doc/gccxml-0.9/Copyright.txt +55 -0
- data/share/doc/gccxml-0.9/gccxml.html +168 -0
- data/share/doc/gccxml-0.9/gccxml.txt +293 -0
- data/share/gccxml-0.9/GCC/2.95/algorithm +76 -0
- data/share/gccxml-0.9/GCC/2.95/bitset +17 -0
- data/share/gccxml-0.9/GCC/2.95/cctype +24 -0
- data/share/gccxml-0.9/GCC/2.95/clocale +14 -0
- data/share/gccxml-0.9/GCC/2.95/cmath +33 -0
- data/share/gccxml-0.9/GCC/2.95/complex +38 -0
- data/share/gccxml-0.9/GCC/2.95/csetjmp +13 -0
- data/share/gccxml-0.9/GCC/2.95/csignal +14 -0
- data/share/gccxml-0.9/GCC/2.95/cstdarg +12 -0
- data/share/gccxml-0.9/GCC/2.95/cstddef +13 -0
- data/share/gccxml-0.9/GCC/2.95/cstdio +55 -0
- data/share/gccxml-0.9/GCC/2.95/cstdlib +66 -0
- data/share/gccxml-0.9/GCC/2.95/cstring +34 -0
- data/share/gccxml-0.9/GCC/2.95/ctime +24 -0
- data/share/gccxml-0.9/GCC/2.95/cwchar +65 -0
- data/share/gccxml-0.9/GCC/2.95/cwctype +31 -0
- data/share/gccxml-0.9/GCC/2.95/deque +19 -0
- data/share/gccxml-0.9/GCC/2.95/exception +20 -0
- data/share/gccxml-0.9/GCC/2.95/fstream +23 -0
- data/share/gccxml-0.9/GCC/2.95/functional +64 -0
- data/share/gccxml-0.9/GCC/2.95/gccxml_bitset +1066 -0
- data/share/gccxml-0.9/GCC/2.95/iomanip +20 -0
- data/share/gccxml-0.9/GCC/2.95/iosfwd +20 -0
- data/share/gccxml-0.9/GCC/2.95/iostream +27 -0
- data/share/gccxml-0.9/GCC/2.95/iterator +39 -0
- data/share/gccxml-0.9/GCC/2.95/list +19 -0
- data/share/gccxml-0.9/GCC/2.95/map +20 -0
- data/share/gccxml-0.9/GCC/2.95/memory +21 -0
- data/share/gccxml-0.9/GCC/2.95/new +13 -0
- data/share/gccxml-0.9/GCC/2.95/numeric +15 -0
- data/share/gccxml-0.9/GCC/2.95/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/2.95/queue +20 -0
- data/share/gccxml-0.9/GCC/2.95/set +20 -0
- data/share/gccxml-0.9/GCC/2.95/sstream +24 -0
- data/share/gccxml-0.9/GCC/2.95/stack +19 -0
- data/share/gccxml-0.9/GCC/2.95/std/bastring.cc +524 -0
- data/share/gccxml-0.9/GCC/2.95/std/complext.h +397 -0
- data/share/gccxml-0.9/GCC/2.95/std/dcomplex.h +92 -0
- data/share/gccxml-0.9/GCC/2.95/std/fcomplex.h +88 -0
- data/share/gccxml-0.9/GCC/2.95/std/gslice_array.h +170 -0
- data/share/gccxml-0.9/GCC/2.95/std/indirect_array.h +157 -0
- data/share/gccxml-0.9/GCC/2.95/std/ldcomplex.h +96 -0
- data/share/gccxml-0.9/GCC/2.95/std/mask_array.h +154 -0
- data/share/gccxml-0.9/GCC/2.95/std/slice_array.h +156 -0
- data/share/gccxml-0.9/GCC/2.95/std/std_valarray.h +728 -0
- data/share/gccxml-0.9/GCC/2.95/std/straits.h +162 -0
- data/share/gccxml-0.9/GCC/2.95/std/valarray_meta.h +1035 -0
- data/share/gccxml-0.9/GCC/2.95/stdexcept +17 -0
- data/share/gccxml-0.9/GCC/2.95/stl_alloc.h +1057 -0
- data/share/gccxml-0.9/GCC/2.95/stl_bvector.h +836 -0
- data/share/gccxml-0.9/GCC/2.95/stl_deque.h +1699 -0
- data/share/gccxml-0.9/GCC/2.95/stl_list.h +843 -0
- data/share/gccxml-0.9/GCC/2.95/stl_tree.h +1331 -0
- data/share/gccxml-0.9/GCC/2.95/stl_vector.h +828 -0
- data/share/gccxml-0.9/GCC/2.95/string +26 -0
- data/share/gccxml-0.9/GCC/2.95/strstream +23 -0
- data/share/gccxml-0.9/GCC/2.95/typeinfo +11 -0
- data/share/gccxml-0.9/GCC/2.95/utility +25 -0
- data/share/gccxml-0.9/GCC/2.95/valarray +52 -0
- data/share/gccxml-0.9/GCC/2.95/vector +19 -0
- data/share/gccxml-0.9/GCC/2.96/sstream +305 -0
- data/share/gccxml-0.9/GCC/3.0/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/3.1/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/3.2/bits/fstream.tcc +500 -0
- data/share/gccxml-0.9/GCC/3.2/bits/gthr-default.h +585 -0
- data/share/gccxml-0.9/GCC/3.2/bits/istream.tcc +1207 -0
- data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.h +1810 -0
- data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.tcc +2397 -0
- data/share/gccxml-0.9/GCC/3.2/bits/messages_members.h +108 -0
- data/share/gccxml-0.9/GCC/3.2/bits/ostream.tcc +713 -0
- data/share/gccxml-0.9/GCC/3.2/bits/sstream.tcc +241 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_deque.h +1682 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_list.h +989 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_tree.h +1462 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_vector.h +1085 -0
- data/share/gccxml-0.9/GCC/3.2/bits/valarray_meta.h +1063 -0
- data/share/gccxml-0.9/GCC/3.2/fstream +579 -0
- data/share/gccxml-0.9/GCC/3.2/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/3.2/sstream +384 -0
- data/share/gccxml-0.9/GCC/3.3/bits/fstream.tcc +530 -0
- data/share/gccxml-0.9/GCC/3.3/bits/list.tcc +378 -0
- data/share/gccxml-0.9/GCC/3.3/bits/locale_facets.h +2050 -0
- data/share/gccxml-0.9/GCC/3.3/bits/messages_members.h +108 -0
- data/share/gccxml-0.9/GCC/3.3/bits/sstream.tcc +243 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_deque.h +1603 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_list.h +1167 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_tree.h +1462 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_vector.h +992 -0
- data/share/gccxml-0.9/GCC/3.3/bits/valarray_meta.h +1135 -0
- data/share/gccxml-0.9/GCC/3.3/fstream +842 -0
- data/share/gccxml-0.9/GCC/3.3/gccxml_builtins.h +22 -0
- data/share/gccxml-0.9/GCC/3.3/sstream +638 -0
- data/share/gccxml-0.9/GCC/3.4/bits/gthr-default.h +669 -0
- data/share/gccxml-0.9/GCC/3.4/gccxml_builtins.h +91 -0
- data/share/gccxml-0.9/GCC/4.0/emmintrin.h +5 -0
- data/share/gccxml-0.9/GCC/4.0/gccxml_apple_emmintrin.h +1037 -0
- data/share/gccxml-0.9/GCC/4.0/gccxml_apple_mmintrin.h +669 -0
- data/share/gccxml-0.9/GCC/4.0/gccxml_apple_xmmintrin.h +870 -0
- data/share/gccxml-0.9/GCC/4.0/gccxml_builtins.h +128 -0
- data/share/gccxml-0.9/GCC/4.0/gccxml_gnu_emmintrin.h +977 -0
- data/share/gccxml-0.9/GCC/4.0/gccxml_gnu_mmintrin.h +636 -0
- data/share/gccxml-0.9/GCC/4.0/gccxml_gnu_xmmintrin.h +833 -0
- data/share/gccxml-0.9/GCC/4.0/mmintrin.h +5 -0
- data/share/gccxml-0.9/GCC/4.0/xmmintrin.h +5 -0
- data/share/gccxml-0.9/GCC/4.1/bits/gthr-default.h +622 -0
- data/share/gccxml-0.9/GCC/4.1/emmintrin.h +5 -0
- data/share/gccxml-0.9/GCC/4.1/gccxml_apple_emmintrin.h +1509 -0
- data/share/gccxml-0.9/GCC/4.1/gccxml_apple_mmintrin.h +942 -0
- data/share/gccxml-0.9/GCC/4.1/gccxml_apple_xmmintrin.h +1192 -0
- data/share/gccxml-0.9/GCC/4.1/gccxml_builtins.h +131 -0
- data/share/gccxml-0.9/GCC/4.1/gccxml_gnu_emmintrin.h +1004 -0
- data/share/gccxml-0.9/GCC/4.1/gccxml_gnu_mmintrin.h +637 -0
- data/share/gccxml-0.9/GCC/4.1/gccxml_gnu_xmmintrin.h +834 -0
- data/share/gccxml-0.9/GCC/4.1/mmintrin.h +5 -0
- data/share/gccxml-0.9/GCC/4.1/xmmintrin.h +5 -0
- data/share/gccxml-0.9/GCC/4.2/emmintrin.h +5 -0
- data/share/gccxml-0.9/GCC/4.2/gccxml_apple_emmintrin.h +1509 -0
- data/share/gccxml-0.9/GCC/4.2/gccxml_apple_mmintrin.h +942 -0
- data/share/gccxml-0.9/GCC/4.2/gccxml_apple_xmmintrin.h +1192 -0
- data/share/gccxml-0.9/GCC/4.2/gccxml_builtins.h +131 -0
- data/share/gccxml-0.9/GCC/4.2/gccxml_gnu_emmintrin.h +1013 -0
- data/share/gccxml-0.9/GCC/4.2/gccxml_gnu_mmintrin.h +663 -0
- data/share/gccxml-0.9/GCC/4.2/gccxml_gnu_xmmintrin.h +860 -0
- data/share/gccxml-0.9/GCC/4.2/mmintrin.h +5 -0
- data/share/gccxml-0.9/GCC/4.2/xmmintrin.h +5 -0
- data/share/gccxml-0.9/GCC/4.3/emmintrin.h +1043 -0
- data/share/gccxml-0.9/GCC/4.3/gccxml_builtins.h +183 -0
- data/share/gccxml-0.9/GCC/4.3/mmintrin.h +663 -0
- data/share/gccxml-0.9/GCC/4.3/xmmintrin.h +867 -0
- data/share/gccxml-0.9/GCC/4.4/bits/c++config.h +1431 -0
- data/share/gccxml-0.9/GCC/4.4/emmintrin.h +1041 -0
- data/share/gccxml-0.9/GCC/4.4/gccxml_builtins.h +153 -0
- data/share/gccxml-0.9/GCC/4.4/mmintrin.h +662 -0
- data/share/gccxml-0.9/GCC/4.4/xmmintrin.h +864 -0
- data/share/gccxml-0.9/GCC/4.5/gccxml_builtins.h +154 -0
- data/share/gccxml-0.9/GCC/4.5/iomanip +349 -0
- data/share/gccxml-0.9/GCC/COPYING.RUNTIME +73 -0
- data/share/gccxml-0.9/GCC/COPYING3 +674 -0
- data/share/gccxml-0.9/IBM/8.0/adapt_headers.sh +34 -0
- data/share/gccxml-0.9/IBM/8.0/stdlib.h.patch +27 -0
- data/share/gccxml-0.9/IBM/8.0/xstring.patch +19 -0
- data/share/gccxml-0.9/IBM/README +8 -0
- data/share/gccxml-0.9/IBM/find_flags +51 -0
- data/share/gccxml-0.9/IBM/find_flags_common +48 -0
- data/share/gccxml-0.9/Intel/find_flags +56 -0
- data/share/gccxml-0.9/Intel/pthread.h +16 -0
- data/share/gccxml-0.9/MIPSpro/7.3/exception +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/gccxml_mpro_internals.h +21 -0
- data/share/gccxml-0.9/MIPSpro/7.3/iomanip +161 -0
- data/share/gccxml-0.9/MIPSpro/7.3/ostream +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stddef.h +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_config.h +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_locale.h +17 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_monetary.h +14 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_numeric_facets.h +13 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_threads.h +11 -0
- data/share/gccxml-0.9/MIPSpro/7.3/string +18 -0
- data/share/gccxml-0.9/MIPSpro/find_flags +70 -0
- data/share/gccxml-0.9/MIPSpro/mipspro_defs.cxx +63 -0
- data/share/gccxml-0.9/Sun/5.8/Cstd.patch +156 -0
- data/share/gccxml-0.9/Sun/5.8/adapt_headers.sh +32 -0
- data/share/gccxml-0.9/Sun/5.8/std-5.10.patch +22 -0
- data/share/gccxml-0.9/Sun/README +8 -0
- data/share/gccxml-0.9/Sun/find_flags +51 -0
- data/share/gccxml-0.9/Sun/find_flags_common +42 -0
- data/share/gccxml-0.9/gccxml_config +2 -0
- data/share/gccxml-0.9/gccxml_identify_compiler.cc +13 -0
- data/share/man/man1/gccxml.1 +246 -0
- metadata +243 -0
@@ -0,0 +1,836 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright (c) 1994
|
4
|
+
* Hewlett-Packard Company
|
5
|
+
*
|
6
|
+
* Permission to use, copy, modify, distribute and sell this software
|
7
|
+
* and its documentation for any purpose is hereby granted without fee,
|
8
|
+
* provided that the above copyright notice appear in all copies and
|
9
|
+
* that both that copyright notice and this permission notice appear
|
10
|
+
* in supporting documentation. Hewlett-Packard Company makes no
|
11
|
+
* representations about the suitability of this software for any
|
12
|
+
* purpose. It is provided "as is" without express or implied warranty.
|
13
|
+
*
|
14
|
+
*
|
15
|
+
* Copyright (c) 1996,1997
|
16
|
+
* Silicon Graphics Computer Systems, Inc.
|
17
|
+
*
|
18
|
+
* Permission to use, copy, modify, distribute and sell this software
|
19
|
+
* and its documentation for any purpose is hereby granted without fee,
|
20
|
+
* provided that the above copyright notice appear in all copies and
|
21
|
+
* that both that copyright notice and this permission notice appear
|
22
|
+
* in supporting documentation. Silicon Graphics makes no
|
23
|
+
* representations about the suitability of this software for any
|
24
|
+
* purpose. It is provided "as is" without express or implied warranty.
|
25
|
+
*/
|
26
|
+
|
27
|
+
/* NOTE: This is an internal header file, included by other STL headers.
|
28
|
+
* You should not attempt to use it directly.
|
29
|
+
*/
|
30
|
+
|
31
|
+
#ifndef __SGI_STL_INTERNAL_BVECTOR_H
|
32
|
+
#define __SGI_STL_INTERNAL_BVECTOR_H
|
33
|
+
|
34
|
+
__STL_BEGIN_NAMESPACE
|
35
|
+
|
36
|
+
static const int __WORD_BIT = int(CHAR_BIT*sizeof(unsigned int));
|
37
|
+
|
38
|
+
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
|
39
|
+
#pragma set woff 1174
|
40
|
+
#pragma set woff 1375
|
41
|
+
#endif
|
42
|
+
|
43
|
+
struct _Bit_reference {
|
44
|
+
unsigned int* _M_p;
|
45
|
+
unsigned int _M_mask;
|
46
|
+
_Bit_reference(unsigned int* __x, unsigned int __y)
|
47
|
+
: _M_p(__x), _M_mask(__y) {}
|
48
|
+
|
49
|
+
public:
|
50
|
+
_Bit_reference() : _M_p(0), _M_mask(0) {}
|
51
|
+
operator bool() const { return !(!(*_M_p & _M_mask)); }
|
52
|
+
_Bit_reference& operator=(bool __x)
|
53
|
+
{
|
54
|
+
if (__x) *_M_p |= _M_mask;
|
55
|
+
else *_M_p &= ~_M_mask;
|
56
|
+
return *this;
|
57
|
+
}
|
58
|
+
_Bit_reference& operator=(const _Bit_reference& __x)
|
59
|
+
{ return *this = bool(__x); }
|
60
|
+
bool operator==(const _Bit_reference& __x) const
|
61
|
+
{ return bool(*this) == bool(__x); }
|
62
|
+
bool operator<(const _Bit_reference& __x) const {
|
63
|
+
return !bool(*this) && bool(__x);
|
64
|
+
}
|
65
|
+
void flip() { *_M_p ^= _M_mask; }
|
66
|
+
};
|
67
|
+
|
68
|
+
inline void swap(_Bit_reference __x, _Bit_reference __y)
|
69
|
+
{
|
70
|
+
bool __tmp = __x;
|
71
|
+
__x = __y;
|
72
|
+
__y = __tmp;
|
73
|
+
}
|
74
|
+
|
75
|
+
struct _Bit_iterator : public random_access_iterator<bool, ptrdiff_t> {
|
76
|
+
typedef _Bit_reference reference;
|
77
|
+
typedef _Bit_reference* pointer;
|
78
|
+
typedef _Bit_iterator iterator;
|
79
|
+
|
80
|
+
unsigned int* _M_p;
|
81
|
+
unsigned int _M_offset;
|
82
|
+
void bump_up() {
|
83
|
+
if (_M_offset++ == __WORD_BIT - 1) {
|
84
|
+
_M_offset = 0;
|
85
|
+
++_M_p;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
void bump_down() {
|
89
|
+
if (_M_offset-- == 0) {
|
90
|
+
_M_offset = __WORD_BIT - 1;
|
91
|
+
--_M_p;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
_Bit_iterator() : _M_p(0), _M_offset(0) {}
|
96
|
+
_Bit_iterator(unsigned int* __x, unsigned int __y)
|
97
|
+
: _M_p(__x), _M_offset(__y) {}
|
98
|
+
reference operator*() const { return reference(_M_p, 1U << _M_offset); }
|
99
|
+
iterator& operator++() {
|
100
|
+
bump_up();
|
101
|
+
return *this;
|
102
|
+
}
|
103
|
+
iterator operator++(int) {
|
104
|
+
iterator __tmp = *this;
|
105
|
+
bump_up();
|
106
|
+
return __tmp;
|
107
|
+
}
|
108
|
+
iterator& operator--() {
|
109
|
+
bump_down();
|
110
|
+
return *this;
|
111
|
+
}
|
112
|
+
iterator operator--(int) {
|
113
|
+
iterator __tmp = *this;
|
114
|
+
bump_down();
|
115
|
+
return __tmp;
|
116
|
+
}
|
117
|
+
iterator& operator+=(difference_type __i) {
|
118
|
+
difference_type __n = __i + _M_offset;
|
119
|
+
_M_p += __n / __WORD_BIT;
|
120
|
+
__n = __n % __WORD_BIT;
|
121
|
+
if (__n < 0) {
|
122
|
+
_M_offset = (unsigned int) __n + __WORD_BIT;
|
123
|
+
--_M_p;
|
124
|
+
} else
|
125
|
+
_M_offset = (unsigned int) __n;
|
126
|
+
return *this;
|
127
|
+
}
|
128
|
+
iterator& operator-=(difference_type __i) {
|
129
|
+
*this += -__i;
|
130
|
+
return *this;
|
131
|
+
}
|
132
|
+
iterator operator+(difference_type __i) const {
|
133
|
+
iterator __tmp = *this;
|
134
|
+
return __tmp += __i;
|
135
|
+
}
|
136
|
+
iterator operator-(difference_type __i) const {
|
137
|
+
iterator __tmp = *this;
|
138
|
+
return __tmp -= __i;
|
139
|
+
}
|
140
|
+
difference_type operator-(iterator __x) const {
|
141
|
+
return __WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset;
|
142
|
+
}
|
143
|
+
reference operator[](difference_type __i) { return *(*this + __i); }
|
144
|
+
bool operator==(const iterator& __x) const {
|
145
|
+
return _M_p == __x._M_p && _M_offset == __x._M_offset;
|
146
|
+
}
|
147
|
+
bool operator!=(const iterator& __x) const {
|
148
|
+
return _M_p != __x._M_p || _M_offset != __x._M_offset;
|
149
|
+
}
|
150
|
+
bool operator<(iterator __x) const {
|
151
|
+
return _M_p < __x._M_p || (_M_p == __x._M_p && _M_offset < __x._M_offset);
|
152
|
+
}
|
153
|
+
};
|
154
|
+
|
155
|
+
struct _Bit_const_iterator
|
156
|
+
: public random_access_iterator<bool, ptrdiff_t>
|
157
|
+
{
|
158
|
+
typedef bool reference;
|
159
|
+
typedef bool const_reference;
|
160
|
+
typedef const bool* pointer;
|
161
|
+
typedef _Bit_const_iterator const_iterator;
|
162
|
+
|
163
|
+
unsigned int* _M_p;
|
164
|
+
unsigned int _M_offset;
|
165
|
+
void bump_up() {
|
166
|
+
if (_M_offset++ == __WORD_BIT - 1) {
|
167
|
+
_M_offset = 0;
|
168
|
+
++_M_p;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
void bump_down() {
|
172
|
+
if (_M_offset-- == 0) {
|
173
|
+
_M_offset = __WORD_BIT - 1;
|
174
|
+
--_M_p;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
_Bit_const_iterator() : _M_p(0), _M_offset(0) {}
|
179
|
+
_Bit_const_iterator(unsigned int* __x, unsigned int __y)
|
180
|
+
: _M_p(__x), _M_offset(__y) {}
|
181
|
+
_Bit_const_iterator(const _Bit_iterator& __x)
|
182
|
+
: _M_p(__x._M_p), _M_offset(__x._M_offset) {}
|
183
|
+
const_reference operator*() const {
|
184
|
+
return _Bit_reference(_M_p, 1U << _M_offset);
|
185
|
+
}
|
186
|
+
const_iterator& operator++() {
|
187
|
+
bump_up();
|
188
|
+
return *this;
|
189
|
+
}
|
190
|
+
const_iterator operator++(int) {
|
191
|
+
const_iterator __tmp = *this;
|
192
|
+
bump_up();
|
193
|
+
return __tmp;
|
194
|
+
}
|
195
|
+
const_iterator& operator--() {
|
196
|
+
bump_down();
|
197
|
+
return *this;
|
198
|
+
}
|
199
|
+
const_iterator operator--(int) {
|
200
|
+
const_iterator __tmp = *this;
|
201
|
+
bump_down();
|
202
|
+
return __tmp;
|
203
|
+
}
|
204
|
+
const_iterator& operator+=(difference_type __i) {
|
205
|
+
difference_type __n = __i + _M_offset;
|
206
|
+
_M_p += __n / __WORD_BIT;
|
207
|
+
__n = __n % __WORD_BIT;
|
208
|
+
if (__n < 0) {
|
209
|
+
_M_offset = (unsigned int) __n + __WORD_BIT;
|
210
|
+
--_M_p;
|
211
|
+
} else
|
212
|
+
_M_offset = (unsigned int) __n;
|
213
|
+
return *this;
|
214
|
+
}
|
215
|
+
const_iterator& operator-=(difference_type __i) {
|
216
|
+
*this += -__i;
|
217
|
+
return *this;
|
218
|
+
}
|
219
|
+
const_iterator operator+(difference_type __i) const {
|
220
|
+
const_iterator __tmp = *this;
|
221
|
+
return __tmp += __i;
|
222
|
+
}
|
223
|
+
const_iterator operator-(difference_type __i) const {
|
224
|
+
const_iterator __tmp = *this;
|
225
|
+
return __tmp -= __i;
|
226
|
+
}
|
227
|
+
difference_type operator-(const_iterator __x) const {
|
228
|
+
return __WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset;
|
229
|
+
}
|
230
|
+
const_reference operator[](difference_type __i) {
|
231
|
+
return *(*this + __i);
|
232
|
+
}
|
233
|
+
bool operator==(const const_iterator& __x) const {
|
234
|
+
return _M_p == __x._M_p && _M_offset == __x._M_offset;
|
235
|
+
}
|
236
|
+
bool operator!=(const const_iterator& __x) const {
|
237
|
+
return _M_p != __x._M_p || _M_offset != __x._M_offset;
|
238
|
+
}
|
239
|
+
bool operator<(const_iterator __x) const {
|
240
|
+
return _M_p < __x._M_p || (_M_p == __x._M_p && _M_offset < __x._M_offset);
|
241
|
+
}
|
242
|
+
};
|
243
|
+
|
244
|
+
// Bit-vector base class, which encapsulates the difference between
|
245
|
+
// old SGI-style allocators and standard-conforming allocators.
|
246
|
+
|
247
|
+
#ifdef __STL_USE_STD_ALLOCATORS
|
248
|
+
|
249
|
+
// Base class for ordinary allocators.
|
250
|
+
template <class _Allocator, bool __is_static>
|
251
|
+
class _Bvector_alloc_base {
|
252
|
+
public:
|
253
|
+
typedef typename _Alloc_traits<bool, _Allocator>::allocator_type
|
254
|
+
allocator_type;
|
255
|
+
allocator_type get_allocator() const { return _M_data_allocator; }
|
256
|
+
|
257
|
+
_Bvector_alloc_base(const allocator_type& __a)
|
258
|
+
: _M_data_allocator(__a), _M_start(), _M_finish(), _M_end_of_storage(0) {}
|
259
|
+
|
260
|
+
protected:
|
261
|
+
unsigned int* _M_bit_alloc(size_t __n)
|
262
|
+
{ return _M_data_allocator.allocate((__n + __WORD_BIT - 1)/__WORD_BIT); }
|
263
|
+
void _M_deallocate() {
|
264
|
+
if (_M_start._M_p)
|
265
|
+
_M_data_allocator.deallocate(_M_start._M_p,
|
266
|
+
_M_end_of_storage - _M_start._M_p);
|
267
|
+
}
|
268
|
+
|
269
|
+
typename _Alloc_traits<unsigned int, _Allocator>::allocator_type
|
270
|
+
_M_data_allocator;
|
271
|
+
_Bit_iterator _M_start;
|
272
|
+
_Bit_iterator _M_finish;
|
273
|
+
unsigned int* _M_end_of_storage;
|
274
|
+
};
|
275
|
+
|
276
|
+
// Specialization for instanceless allocators.
|
277
|
+
template <class _Allocator>
|
278
|
+
class _Bvector_alloc_base<_Allocator, true> {
|
279
|
+
public:
|
280
|
+
typedef typename _Alloc_traits<bool, _Allocator>::allocator_type
|
281
|
+
allocator_type;
|
282
|
+
allocator_type get_allocator() const { return allocator_type(); }
|
283
|
+
|
284
|
+
_Bvector_alloc_base(const allocator_type&)
|
285
|
+
: _M_start(), _M_finish(), _M_end_of_storage(0) {}
|
286
|
+
|
287
|
+
protected:
|
288
|
+
typedef typename _Alloc_traits<unsigned int, _Allocator>::_Alloc_type
|
289
|
+
_Alloc_type;
|
290
|
+
|
291
|
+
unsigned int* _M_bit_alloc(size_t __n)
|
292
|
+
{ return _Alloc_type::allocate((__n + __WORD_BIT - 1)/__WORD_BIT); }
|
293
|
+
void _M_deallocate() {
|
294
|
+
if (_M_start._M_p)
|
295
|
+
_Alloc_type::deallocate(_M_start._M_p,
|
296
|
+
_M_end_of_storage - _M_start._M_p);
|
297
|
+
}
|
298
|
+
|
299
|
+
_Bit_iterator _M_start;
|
300
|
+
_Bit_iterator _M_finish;
|
301
|
+
unsigned int* _M_end_of_storage;
|
302
|
+
};
|
303
|
+
|
304
|
+
template <class _Alloc>
|
305
|
+
class _Bvector_base
|
306
|
+
: public _Bvector_alloc_base<_Alloc,
|
307
|
+
_Alloc_traits<bool, _Alloc>::_S_instanceless>
|
308
|
+
{
|
309
|
+
typedef _Bvector_alloc_base<_Alloc,
|
310
|
+
_Alloc_traits<bool, _Alloc>::_S_instanceless>
|
311
|
+
_Base;
|
312
|
+
public:
|
313
|
+
typedef typename _Base::allocator_type allocator_type;
|
314
|
+
|
315
|
+
_Bvector_base(const allocator_type& __a) : _Base(__a) {}
|
316
|
+
~_Bvector_base() { _Base::_M_deallocate(); }
|
317
|
+
};
|
318
|
+
|
319
|
+
#else /* __STL_USE_STD_ALLOCATORS */
|
320
|
+
|
321
|
+
template <class _Alloc>
|
322
|
+
class _Bvector_base
|
323
|
+
{
|
324
|
+
public:
|
325
|
+
typedef _Alloc allocator_type;
|
326
|
+
allocator_type get_allocator() const { return allocator_type(); }
|
327
|
+
|
328
|
+
_Bvector_base(const allocator_type&)
|
329
|
+
: _M_start(), _M_finish(), _M_end_of_storage(0) {}
|
330
|
+
~_Bvector_base() { _M_deallocate(); }
|
331
|
+
|
332
|
+
protected:
|
333
|
+
typedef simple_alloc<unsigned int, _Alloc> _Alloc_type;
|
334
|
+
|
335
|
+
unsigned int* _M_bit_alloc(size_t __n)
|
336
|
+
{ return _Alloc_type::allocate((__n + __WORD_BIT - 1)/__WORD_BIT); }
|
337
|
+
void _M_deallocate() {
|
338
|
+
if (_M_start._M_p)
|
339
|
+
_Alloc_type::deallocate(_M_start._M_p,
|
340
|
+
_M_end_of_storage - _M_start._M_p);
|
341
|
+
}
|
342
|
+
|
343
|
+
_Bit_iterator _M_start;
|
344
|
+
_Bit_iterator _M_finish;
|
345
|
+
unsigned int* _M_end_of_storage;
|
346
|
+
};
|
347
|
+
|
348
|
+
#endif /* __STL_USE_STD_ALLOCATORS */
|
349
|
+
|
350
|
+
// The next few lines are confusing. What we're doing is declaring a
|
351
|
+
// partial specialization of vector<T, Alloc> if we have the necessary
|
352
|
+
// compiler support. Otherwise, we define a class bit_vector which uses
|
353
|
+
// the default allocator.
|
354
|
+
|
355
|
+
#if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && !defined(__STL_NO_BOOL)
|
356
|
+
#define __SGI_STL_VECBOOL_TEMPLATE
|
357
|
+
#define __BVECTOR vector
|
358
|
+
#else
|
359
|
+
#undef __SGI_STL_VECBOOL_TEMPLATE
|
360
|
+
#define __BVECTOR bit_vector
|
361
|
+
#endif
|
362
|
+
|
363
|
+
# ifdef __SGI_STL_VECBOOL_TEMPLATE
|
364
|
+
__STL_END_NAMESPACE
|
365
|
+
# include <stl_vector.h>
|
366
|
+
__STL_BEGIN_NAMESPACE
|
367
|
+
template<class _Alloc> class vector<bool,_Alloc>
|
368
|
+
: public _Bvector_base<_Alloc>
|
369
|
+
# else /* __SGI_STL_VECBOOL_TEMPLATE */
|
370
|
+
class bit_vector
|
371
|
+
: public _Bvector_base<__STL_DEFAULT_ALLOCATOR(bool) >
|
372
|
+
# endif /* __SGI_STL_VECBOOL_TEMPLATE */
|
373
|
+
{
|
374
|
+
# ifdef __SGI_STL_VECBOOL_TEMPLATE
|
375
|
+
typedef _Bvector_base<_Alloc> _Base;
|
376
|
+
# else /* __SGI_STL_VECBOOL_TEMPLATE */
|
377
|
+
typedef _Bvector_base<__STL_DEFAULT_ALLOCATOR(bool) > _Base;
|
378
|
+
# endif /* __SGI_STL_VECBOOL_TEMPLATE */
|
379
|
+
public:
|
380
|
+
typedef bool value_type;
|
381
|
+
typedef size_t size_type;
|
382
|
+
typedef ptrdiff_t difference_type;
|
383
|
+
typedef _Bit_reference reference;
|
384
|
+
typedef bool const_reference;
|
385
|
+
typedef _Bit_reference* pointer;
|
386
|
+
typedef const bool* const_pointer;
|
387
|
+
|
388
|
+
typedef _Bit_iterator iterator;
|
389
|
+
typedef _Bit_const_iterator const_iterator;
|
390
|
+
|
391
|
+
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
|
392
|
+
typedef reverse_iterator<const_iterator> const_reverse_iterator;
|
393
|
+
typedef reverse_iterator<iterator> reverse_iterator;
|
394
|
+
#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
|
395
|
+
typedef reverse_iterator<const_iterator, value_type, const_reference,
|
396
|
+
difference_type> const_reverse_iterator;
|
397
|
+
typedef reverse_iterator<iterator, value_type, reference, difference_type>
|
398
|
+
reverse_iterator;
|
399
|
+
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
|
400
|
+
|
401
|
+
typedef typename _Base::allocator_type allocator_type;
|
402
|
+
allocator_type get_allocator() const { return _Base::get_allocator(); }
|
403
|
+
|
404
|
+
protected:
|
405
|
+
using _Base::_M_bit_alloc;
|
406
|
+
using _Base::_M_deallocate;
|
407
|
+
using _Base::_M_start;
|
408
|
+
using _Base::_M_finish;
|
409
|
+
using _Base::_M_end_of_storage;
|
410
|
+
|
411
|
+
protected:
|
412
|
+
void _M_initialize(size_type __n) {
|
413
|
+
unsigned int* __q = _M_bit_alloc(__n);
|
414
|
+
_M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT;
|
415
|
+
_M_start = iterator(__q, 0);
|
416
|
+
_M_finish = _M_start + difference_type(__n);
|
417
|
+
}
|
418
|
+
void _M_insert_aux(iterator __position, bool __x) {
|
419
|
+
if (_M_finish._M_p != _M_end_of_storage) {
|
420
|
+
copy_backward(__position, _M_finish, _M_finish + 1);
|
421
|
+
*__position = __x;
|
422
|
+
++_M_finish;
|
423
|
+
}
|
424
|
+
else {
|
425
|
+
size_type __len = size() ? 2 * size() : __WORD_BIT;
|
426
|
+
unsigned int* __q = _M_bit_alloc(__len);
|
427
|
+
iterator __i = copy(begin(), __position, iterator(__q, 0));
|
428
|
+
*__i++ = __x;
|
429
|
+
_M_finish = copy(__position, end(), __i);
|
430
|
+
_M_deallocate();
|
431
|
+
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
|
432
|
+
_M_start = iterator(__q, 0);
|
433
|
+
}
|
434
|
+
}
|
435
|
+
|
436
|
+
#ifdef __STL_MEMBER_TEMPLATES
|
437
|
+
template <class _InputIterator>
|
438
|
+
void _M_initialize_range(_InputIterator __first, _InputIterator __last,
|
439
|
+
input_iterator_tag) {
|
440
|
+
_M_start = iterator();
|
441
|
+
_M_finish = iterator();
|
442
|
+
_M_end_of_storage = 0;
|
443
|
+
for ( ; __first != __last; ++__first)
|
444
|
+
push_back(*__first);
|
445
|
+
}
|
446
|
+
|
447
|
+
template <class _ForwardIterator>
|
448
|
+
void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
|
449
|
+
forward_iterator_tag) {
|
450
|
+
size_type __n = 0;
|
451
|
+
distance(__first, __last, __n);
|
452
|
+
_M_initialize(__n);
|
453
|
+
copy(__first, __last, _M_start);
|
454
|
+
}
|
455
|
+
|
456
|
+
template <class _InputIterator>
|
457
|
+
void _M_insert_range(iterator __pos,
|
458
|
+
_InputIterator __first, _InputIterator __last,
|
459
|
+
input_iterator_tag) {
|
460
|
+
for ( ; __first != __last; ++__first) {
|
461
|
+
__pos = insert(__pos, *__first);
|
462
|
+
++__pos;
|
463
|
+
}
|
464
|
+
}
|
465
|
+
|
466
|
+
template <class _ForwardIterator>
|
467
|
+
void _M_insert_range(iterator __position,
|
468
|
+
_ForwardIterator __first, _ForwardIterator __last,
|
469
|
+
forward_iterator_tag) {
|
470
|
+
if (__first != __last) {
|
471
|
+
size_type __n = 0;
|
472
|
+
distance(__first, __last, __n);
|
473
|
+
if (capacity() - size() >= __n) {
|
474
|
+
copy_backward(__position, end(), _M_finish + difference_type(__n));
|
475
|
+
copy(__first, __last, __position);
|
476
|
+
_M_finish += difference_type(__n);
|
477
|
+
}
|
478
|
+
else {
|
479
|
+
size_type __len = size() + max(size(), __n);
|
480
|
+
unsigned int* __q = _M_bit_alloc(__len);
|
481
|
+
iterator __i = copy(begin(), __position, iterator(__q, 0));
|
482
|
+
__i = copy(__first, __last, __i);
|
483
|
+
_M_finish = copy(__position, end(), __i);
|
484
|
+
_M_deallocate();
|
485
|
+
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
|
486
|
+
_M_start = iterator(__q, 0);
|
487
|
+
}
|
488
|
+
}
|
489
|
+
}
|
490
|
+
|
491
|
+
#endif /* __STL_MEMBER_TEMPLATES */
|
492
|
+
|
493
|
+
public:
|
494
|
+
iterator begin() { return _M_start; }
|
495
|
+
const_iterator begin() const { return _M_start; }
|
496
|
+
iterator end() { return _M_finish; }
|
497
|
+
const_iterator end() const { return _M_finish; }
|
498
|
+
|
499
|
+
reverse_iterator rbegin() { return reverse_iterator(end()); }
|
500
|
+
const_reverse_iterator rbegin() const {
|
501
|
+
return const_reverse_iterator(end());
|
502
|
+
}
|
503
|
+
reverse_iterator rend() { return reverse_iterator(begin()); }
|
504
|
+
const_reverse_iterator rend() const {
|
505
|
+
return const_reverse_iterator(begin());
|
506
|
+
}
|
507
|
+
|
508
|
+
size_type size() const { return size_type(end() - begin()); }
|
509
|
+
size_type max_size() const { return size_type(-1); }
|
510
|
+
size_type capacity() const {
|
511
|
+
return size_type(const_iterator(_M_end_of_storage, 0) - begin());
|
512
|
+
}
|
513
|
+
bool empty() const { return begin() == end(); }
|
514
|
+
reference operator[](size_type __n) {
|
515
|
+
return *(begin() + difference_type(__n));
|
516
|
+
}
|
517
|
+
const_reference operator[](size_type __n) const {
|
518
|
+
return *(begin() + difference_type(__n));
|
519
|
+
}
|
520
|
+
|
521
|
+
explicit __BVECTOR(const allocator_type& __a = allocator_type())
|
522
|
+
: _Base(__a) {}
|
523
|
+
|
524
|
+
__BVECTOR(size_type __n, bool __value,
|
525
|
+
const allocator_type& __a = allocator_type())
|
526
|
+
: _Base(__a)
|
527
|
+
{
|
528
|
+
_M_initialize(__n);
|
529
|
+
fill(_M_start._M_p, _M_end_of_storage, __value ? ~0 : 0);
|
530
|
+
}
|
531
|
+
|
532
|
+
explicit __BVECTOR(size_type __n)
|
533
|
+
: _Base(allocator_type())
|
534
|
+
{
|
535
|
+
_M_initialize(__n);
|
536
|
+
fill(_M_start._M_p, _M_end_of_storage, 0);
|
537
|
+
}
|
538
|
+
|
539
|
+
__BVECTOR(const __BVECTOR& __x) : _Base(__x.get_allocator()) {
|
540
|
+
_M_initialize(__x.size());
|
541
|
+
copy(__x.begin(), __x.end(), _M_start);
|
542
|
+
}
|
543
|
+
|
544
|
+
#ifdef __STL_MEMBER_TEMPLATES
|
545
|
+
// Check whether it's an integral type. If so, it's not an iterator.
|
546
|
+
template <class _InputIterator>
|
547
|
+
__BVECTOR(_InputIterator __first, _InputIterator __last,
|
548
|
+
const allocator_type& __a = allocator_type())
|
549
|
+
: _Base(__a)
|
550
|
+
{
|
551
|
+
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
|
552
|
+
_M_initialize_dispatch(__first, __last, _Integral());
|
553
|
+
}
|
554
|
+
|
555
|
+
template <class _Integer>
|
556
|
+
void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) {
|
557
|
+
_M_initialize(__n);
|
558
|
+
fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
|
559
|
+
}
|
560
|
+
|
561
|
+
template <class _InputIterator>
|
562
|
+
void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
|
563
|
+
__false_type) {
|
564
|
+
_M_initialize_range(__first, __last, __ITERATOR_CATEGORY(__first));
|
565
|
+
}
|
566
|
+
#else /* __STL_MEMBER_TEMPLATES */
|
567
|
+
__BVECTOR(const_iterator __first, const_iterator __last,
|
568
|
+
const allocator_type& __a = allocator_type())
|
569
|
+
: _Base(__a)
|
570
|
+
{
|
571
|
+
size_type __n = 0;
|
572
|
+
distance(__first, __last, __n);
|
573
|
+
_M_initialize(__n);
|
574
|
+
copy(__first, __last, _M_start);
|
575
|
+
}
|
576
|
+
__BVECTOR(const bool* __first, const bool* __last,
|
577
|
+
const allocator_type& __a = allocator_type())
|
578
|
+
: _Base(__a)
|
579
|
+
{
|
580
|
+
size_type __n = 0;
|
581
|
+
distance(__first, __last, __n);
|
582
|
+
_M_initialize(__n);
|
583
|
+
copy(__first, __last, _M_start);
|
584
|
+
}
|
585
|
+
#endif /* __STL_MEMBER_TEMPLATES */
|
586
|
+
|
587
|
+
~__BVECTOR() { }
|
588
|
+
|
589
|
+
__BVECTOR& operator=(const __BVECTOR& __x) {
|
590
|
+
if (&__x == this) return *this;
|
591
|
+
if (__x.size() > capacity()) {
|
592
|
+
_M_deallocate();
|
593
|
+
_M_initialize(__x.size());
|
594
|
+
}
|
595
|
+
copy(__x.begin(), __x.end(), begin());
|
596
|
+
_M_finish = begin() + difference_type(__x.size());
|
597
|
+
return *this;
|
598
|
+
}
|
599
|
+
|
600
|
+
// assign(), a generalized assignment member function. Two
|
601
|
+
// versions: one that takes a count, and one that takes a range.
|
602
|
+
// The range version is a member template, so we dispatch on whether
|
603
|
+
// or not the type is an integer.
|
604
|
+
|
605
|
+
void assign(size_t __n, bool __x) {
|
606
|
+
if (__n > size()) {
|
607
|
+
fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
|
608
|
+
insert(end(), __n - size(), __x);
|
609
|
+
}
|
610
|
+
else {
|
611
|
+
erase(begin() + __n, end());
|
612
|
+
fill(_M_start._M_p, _M_end_of_storage, __x ? ~0 : 0);
|
613
|
+
}
|
614
|
+
}
|
615
|
+
|
616
|
+
#ifdef __STL_MEMBER_TEMPLATES
|
617
|
+
|
618
|
+
template <class _InputIterator>
|
619
|
+
void assign(_InputIterator __first, _InputIterator __last) {
|
620
|
+
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
|
621
|
+
_M_assign_dispatch(__first, __last, _Integral());
|
622
|
+
}
|
623
|
+
|
624
|
+
template <class _Integer>
|
625
|
+
void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
|
626
|
+
{ assign((size_t) __n, (bool) __val); }
|
627
|
+
|
628
|
+
template <class _InputIter>
|
629
|
+
void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type)
|
630
|
+
{ _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); }
|
631
|
+
|
632
|
+
template <class _InputIterator>
|
633
|
+
void _M_assign_aux(_InputIterator __first, _InputIterator __last,
|
634
|
+
input_iterator_tag) {
|
635
|
+
iterator __cur = begin();
|
636
|
+
for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
|
637
|
+
*__cur = *__first;
|
638
|
+
if (__first == __last)
|
639
|
+
erase(__cur, end());
|
640
|
+
else
|
641
|
+
insert(end(), __first, __last);
|
642
|
+
}
|
643
|
+
|
644
|
+
template <class _ForwardIterator>
|
645
|
+
void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
|
646
|
+
forward_iterator_tag) {
|
647
|
+
size_type __len = 0;
|
648
|
+
distance(__first, __last, __len);
|
649
|
+
if (__len < size())
|
650
|
+
erase(copy(__first, __last, begin()), end());
|
651
|
+
else {
|
652
|
+
_ForwardIterator __mid = __first;
|
653
|
+
advance(__mid, size());
|
654
|
+
copy(__first, __mid, begin());
|
655
|
+
insert(end(), __mid, __last);
|
656
|
+
}
|
657
|
+
}
|
658
|
+
|
659
|
+
#endif /* __STL_MEMBER_TEMPLATES */
|
660
|
+
|
661
|
+
void reserve(size_type __n) {
|
662
|
+
if (capacity() < __n) {
|
663
|
+
unsigned int* __q = _M_bit_alloc(__n);
|
664
|
+
_M_finish = copy(begin(), end(), iterator(__q, 0));
|
665
|
+
_M_deallocate();
|
666
|
+
_M_start = iterator(__q, 0);
|
667
|
+
_M_end_of_storage = __q + (__n + __WORD_BIT - 1)/__WORD_BIT;
|
668
|
+
}
|
669
|
+
}
|
670
|
+
|
671
|
+
reference front() { return *begin(); }
|
672
|
+
const_reference front() const { return *begin(); }
|
673
|
+
reference back() { return *(end() - 1); }
|
674
|
+
const_reference back() const { return *(end() - 1); }
|
675
|
+
void push_back(bool __x) {
|
676
|
+
if (_M_finish._M_p != _M_end_of_storage)
|
677
|
+
*_M_finish++ = __x;
|
678
|
+
else
|
679
|
+
_M_insert_aux(end(), __x);
|
680
|
+
}
|
681
|
+
void swap(__BVECTOR& __x) {
|
682
|
+
__STD::swap(_M_start, __x._M_start);
|
683
|
+
__STD::swap(_M_finish, __x._M_finish);
|
684
|
+
__STD::swap(_M_end_of_storage, __x._M_end_of_storage);
|
685
|
+
}
|
686
|
+
iterator insert(iterator __position, bool __x = bool()) {
|
687
|
+
difference_type __n = __position - begin();
|
688
|
+
if (_M_finish._M_p != _M_end_of_storage && __position == end())
|
689
|
+
*_M_finish++ = __x;
|
690
|
+
else
|
691
|
+
_M_insert_aux(__position, __x);
|
692
|
+
return begin() + __n;
|
693
|
+
}
|
694
|
+
|
695
|
+
#ifdef __STL_MEMBER_TEMPLATES
|
696
|
+
// Check whether it's an integral type. If so, it's not an iterator.
|
697
|
+
template <class _InputIterator>
|
698
|
+
void insert(iterator __position,
|
699
|
+
_InputIterator __first, _InputIterator __last) {
|
700
|
+
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
|
701
|
+
_M_insert_dispatch(__position, __first, __last, _Integral());
|
702
|
+
}
|
703
|
+
|
704
|
+
template <class _Integer>
|
705
|
+
void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
|
706
|
+
__true_type) {
|
707
|
+
insert(__pos, (size_type) __n, (bool) __x);
|
708
|
+
}
|
709
|
+
|
710
|
+
template <class _InputIterator>
|
711
|
+
void _M_insert_dispatch(iterator __pos,
|
712
|
+
_InputIterator __first, _InputIterator __last,
|
713
|
+
__false_type) {
|
714
|
+
_M_insert_range(__pos, __first, __last, __ITERATOR_CATEGORY(__first));
|
715
|
+
}
|
716
|
+
#else /* __STL_MEMBER_TEMPLATES */
|
717
|
+
void insert(iterator __position,
|
718
|
+
const_iterator __first, const_iterator __last) {
|
719
|
+
if (__first == __last) return;
|
720
|
+
size_type __n = 0;
|
721
|
+
distance(__first, __last, __n);
|
722
|
+
if (capacity() - size() >= __n) {
|
723
|
+
copy_backward(__position, end(), _M_finish + __n);
|
724
|
+
copy(__first, __last, __position);
|
725
|
+
_M_finish += __n;
|
726
|
+
}
|
727
|
+
else {
|
728
|
+
size_type __len = size() + max(size(), __n);
|
729
|
+
unsigned int* __q = _M_bit_alloc(__len);
|
730
|
+
iterator __i = copy(begin(), __position, iterator(__q, 0));
|
731
|
+
__i = copy(__first, __last, __i);
|
732
|
+
_M_finish = copy(__position, end(), __i);
|
733
|
+
_M_deallocate();
|
734
|
+
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
|
735
|
+
_M_start = iterator(__q, 0);
|
736
|
+
}
|
737
|
+
}
|
738
|
+
|
739
|
+
void insert(iterator __position, const bool* __first, const bool* __last) {
|
740
|
+
if (__first == __last) return;
|
741
|
+
size_type __n = 0;
|
742
|
+
distance(__first, __last, __n);
|
743
|
+
if (capacity() - size() >= __n) {
|
744
|
+
copy_backward(__position, end(), _M_finish + __n);
|
745
|
+
copy(__first, __last, __position);
|
746
|
+
_M_finish += __n;
|
747
|
+
}
|
748
|
+
else {
|
749
|
+
size_type __len = size() + max(size(), __n);
|
750
|
+
unsigned int* __q = _M_bit_alloc(__len);
|
751
|
+
iterator __i = copy(begin(), __position, iterator(__q, 0));
|
752
|
+
__i = copy(__first, __last, __i);
|
753
|
+
_M_finish = copy(__position, end(), __i);
|
754
|
+
_M_deallocate();
|
755
|
+
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
|
756
|
+
_M_start = iterator(__q, 0);
|
757
|
+
}
|
758
|
+
}
|
759
|
+
#endif /* __STL_MEMBER_TEMPLATES */
|
760
|
+
|
761
|
+
void insert(iterator __position, size_type __n, bool __x) {
|
762
|
+
if (__n == 0) return;
|
763
|
+
if (capacity() - size() >= __n) {
|
764
|
+
copy_backward(__position, end(), _M_finish + difference_type(__n));
|
765
|
+
fill(__position, __position + difference_type(__n), __x);
|
766
|
+
_M_finish += difference_type(__n);
|
767
|
+
}
|
768
|
+
else {
|
769
|
+
size_type __len = size() + max(size(), __n);
|
770
|
+
unsigned int* __q = _M_bit_alloc(__len);
|
771
|
+
iterator __i = copy(begin(), __position, iterator(__q, 0));
|
772
|
+
fill_n(__i, __n, __x);
|
773
|
+
_M_finish = copy(__position, end(), __i + difference_type(__n));
|
774
|
+
_M_deallocate();
|
775
|
+
_M_end_of_storage = __q + (__len + __WORD_BIT - 1)/__WORD_BIT;
|
776
|
+
_M_start = iterator(__q, 0);
|
777
|
+
}
|
778
|
+
}
|
779
|
+
|
780
|
+
void pop_back() { --_M_finish; }
|
781
|
+
iterator erase(iterator __position) {
|
782
|
+
if (__position + 1 != end())
|
783
|
+
copy(__position + 1, end(), __position);
|
784
|
+
--_M_finish;
|
785
|
+
return __position;
|
786
|
+
}
|
787
|
+
iterator erase(iterator __first, iterator __last) {
|
788
|
+
_M_finish = copy(__last, end(), __first);
|
789
|
+
return __first;
|
790
|
+
}
|
791
|
+
void resize(size_type __new_size, bool __x = bool()) {
|
792
|
+
if (__new_size < size())
|
793
|
+
erase(begin() + difference_type(__new_size), end());
|
794
|
+
else
|
795
|
+
insert(end(), __new_size - size(), __x);
|
796
|
+
}
|
797
|
+
void clear() { erase(begin(), end()); }
|
798
|
+
};
|
799
|
+
|
800
|
+
#ifdef __SGI_STL_VECBOOL_TEMPLATE
|
801
|
+
|
802
|
+
typedef vector<bool, alloc> bit_vector;
|
803
|
+
|
804
|
+
#else /* __SGI_STL_VECBOOL_TEMPLATE */
|
805
|
+
|
806
|
+
inline bool
|
807
|
+
operator==(const bit_vector& __x, const bit_vector& __y)
|
808
|
+
{
|
809
|
+
return (__x.size() == __y.size() &&
|
810
|
+
equal(__x.begin(), __x.end(), __y.begin()));
|
811
|
+
}
|
812
|
+
|
813
|
+
inline bool
|
814
|
+
operator<(const bit_vector& __x, const bit_vector& __y)
|
815
|
+
{
|
816
|
+
return lexicographical_compare(__x.begin(), __x.end(),
|
817
|
+
__y.begin(), __y.end());
|
818
|
+
}
|
819
|
+
|
820
|
+
#endif /* __SGI_STL_VECBOOL_TEMPLATE */
|
821
|
+
|
822
|
+
#undef __SGI_STL_VECBOOL_TEMPLATE
|
823
|
+
#undef __BVECTOR
|
824
|
+
|
825
|
+
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
|
826
|
+
#pragma reset woff 1174
|
827
|
+
#pragma reset woff 1375
|
828
|
+
#endif
|
829
|
+
|
830
|
+
__STL_END_NAMESPACE
|
831
|
+
|
832
|
+
#endif /* __SGI_STL_INTERNAL_BVECTOR_H */
|
833
|
+
|
834
|
+
// Local Variables:
|
835
|
+
// mode:C++
|
836
|
+
// End:
|