gccxml_gem 0.9-x86-cygwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +75 -0
- data/bin/gccxml.exe +0 -0
- data/bin/gccxml_cc1plus.exe +0 -0
- data/gccxml.rb +50 -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/Borland/5.5/Wrappers/algorithm +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/algorithm.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/bitset +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/bitset.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cctype +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cfloat +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/climits +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cmath +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/complex +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/complex.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cstddef +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cstdio +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cstdlib +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cstring +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cstring.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/ctime +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cwchar +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/cwctype +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/deque +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/deque.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/exception +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/exception.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/fstream +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/fstream.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/function +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/function.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/functional +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/gccxml_typeinfo.h +146 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iomanip +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iomanip.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/ios +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/ios.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iosfwd +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iosfwd.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iostream +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iostream.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/istream +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/istream.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iterator +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/iterator.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/limits +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/limits.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/list +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/list.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/locale +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/locale.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/map +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/map.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/memory +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/memory.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/new +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/new.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/numeric +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/numeric.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/ostream +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/ostream.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/queue +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/queue.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/codecvt +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/collate +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/ctype +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/iosbase +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/iotraits +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/iterator +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/lochelp +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/locimpl +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/locvector +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/messages +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/money +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/numbrw +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/numeral +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/rwdispatch.h +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/rwlocale +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/rwstderr_macros.h +64 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/string_ref +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/time +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/traits +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/tree +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/usefacet +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/valimp +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/rw/vendor +1 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/set +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/set.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/sstream +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/sstream.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/stack +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/stack.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/stdexcept +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/stdexcept.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/streambuf +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/streambuf.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/string +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/string.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/strstream +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/strstream.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/typeinfo +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/typeinfo.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/utility +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/utility.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/valarray +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/valarray.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/vector +7 -0
- data/share/gccxml-0.9/Borland/5.5/Wrappers/vector.h +7 -0
- data/share/gccxml-0.9/Borland/5.5/except.h +154 -0
- data/share/gccxml-0.9/Borland/5.5/gccxml_fstream.h +431 -0
- data/share/gccxml-0.9/Borland/5.5/gccxml_new.h +166 -0
- data/share/gccxml-0.9/Borland/5.5/gccxml_valarray.h +786 -0
- data/share/gccxml-0.9/Borland/5.5/gccxml_vector.h +1457 -0
- data/share/gccxml-0.9/Borland/5.5/io.h +352 -0
- data/share/gccxml-0.9/Borland/5.5/oaidl.h +7006 -0
- data/share/gccxml-0.9/Borland/5.5/propidl.h +1477 -0
- data/share/gccxml-0.9/Borland/5.5/rw/locimpl.h +477 -0
- data/share/gccxml-0.9/Borland/5.5/rw/rwlocale.h +619 -0
- data/share/gccxml-0.9/Borland/5.5/stdarg.h +55 -0
- data/share/gccxml-0.9/Borland/5.5/valarray.cc +2883 -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/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/gccxml_builtins.h +91 -0
- data/share/gccxml-0.9/GCC/4.0/gccxml_builtins.h +128 -0
- data/share/gccxml-0.9/GCC/4.1/bits/gthr-default.h +618 -0
- data/share/gccxml-0.9/GCC/4.1/gccxml_builtins.h +131 -0
- data/share/gccxml-0.9/GCC/4.2/gccxml_builtins.h +131 -0
- data/share/gccxml-0.9/GCC/find_flags +105 -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 +137 -0
- data/share/gccxml-0.9/Sun/5.8/adaptation.patch +168 -0
- data/share/gccxml-0.9/Sun/README +8 -0
- data/share/gccxml-0.9/Sun/adapt_headers.sh +24 -0
- data/share/gccxml-0.9/Sun/find_flags +69 -0
- data/share/gccxml-0.9/gccxml_config +2 -0
- data/share/gccxml-0.9/gccxml_find_flags +93 -0
- data/share/man/man1/gccxml.1 +246 -0
- metadata +324 -0
@@ -0,0 +1,828 @@
|
|
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
|
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_VECTOR_H
|
32
|
+
#define __SGI_STL_INTERNAL_VECTOR_H
|
33
|
+
|
34
|
+
__STL_BEGIN_NAMESPACE
|
35
|
+
|
36
|
+
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
|
37
|
+
#pragma set woff 1174
|
38
|
+
#pragma set woff 1375
|
39
|
+
#endif
|
40
|
+
|
41
|
+
// The vector base class serves two purposes. First, its constructor
|
42
|
+
// and destructor allocate (but don't initialize) storage. This makes
|
43
|
+
// exception safety easier. Second, the base class encapsulates all of
|
44
|
+
// the differences between SGI-style allocators and standard-conforming
|
45
|
+
// allocators.
|
46
|
+
|
47
|
+
#ifdef __STL_USE_STD_ALLOCATORS
|
48
|
+
|
49
|
+
// Base class for ordinary allocators.
|
50
|
+
template <class _Tp, class _Allocator, bool _IsStatic>
|
51
|
+
class _Vector_alloc_base {
|
52
|
+
public:
|
53
|
+
typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
|
54
|
+
allocator_type;
|
55
|
+
allocator_type get_allocator() const { return _M_data_allocator; }
|
56
|
+
|
57
|
+
_Vector_alloc_base(const allocator_type& __a)
|
58
|
+
: _M_data_allocator(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
|
59
|
+
{}
|
60
|
+
|
61
|
+
protected:
|
62
|
+
allocator_type _M_data_allocator;
|
63
|
+
_Tp* _M_start;
|
64
|
+
_Tp* _M_finish;
|
65
|
+
_Tp* _M_end_of_storage;
|
66
|
+
|
67
|
+
_Tp* _M_allocate(size_t __n)
|
68
|
+
{ return _M_data_allocator.allocate(__n); }
|
69
|
+
void _M_deallocate(_Tp* __p, size_t __n)
|
70
|
+
{ if (__p) _M_data_allocator.deallocate(__p, __n); }
|
71
|
+
};
|
72
|
+
|
73
|
+
// Specialization for allocators that have the property that we don't
|
74
|
+
// actually have to store an allocator object.
|
75
|
+
template <class _Tp, class _Allocator>
|
76
|
+
class _Vector_alloc_base<_Tp, _Allocator, true> {
|
77
|
+
public:
|
78
|
+
typedef typename _Alloc_traits<_Tp, _Allocator>::allocator_type
|
79
|
+
allocator_type;
|
80
|
+
allocator_type get_allocator() const { return allocator_type(); }
|
81
|
+
|
82
|
+
_Vector_alloc_base(const allocator_type&)
|
83
|
+
: _M_start(0), _M_finish(0), _M_end_of_storage(0)
|
84
|
+
{}
|
85
|
+
|
86
|
+
protected:
|
87
|
+
_Tp* _M_start;
|
88
|
+
_Tp* _M_finish;
|
89
|
+
_Tp* _M_end_of_storage;
|
90
|
+
|
91
|
+
typedef typename _Alloc_traits<_Tp, _Allocator>::_Alloc_type _Alloc_type;
|
92
|
+
_Tp* _M_allocate(size_t __n)
|
93
|
+
{ return _Alloc_type::allocate(__n); }
|
94
|
+
void _M_deallocate(_Tp* __p, size_t __n)
|
95
|
+
{ _Alloc_type::deallocate(__p, __n);}
|
96
|
+
};
|
97
|
+
|
98
|
+
template <class _Tp, class _Alloc>
|
99
|
+
struct _Vector_base
|
100
|
+
: public _Vector_alloc_base<_Tp, _Alloc,
|
101
|
+
_Alloc_traits<_Tp, _Alloc>::_S_instanceless>
|
102
|
+
{
|
103
|
+
typedef _Vector_alloc_base<_Tp, _Alloc,
|
104
|
+
_Alloc_traits<_Tp, _Alloc>::_S_instanceless>
|
105
|
+
_Base;
|
106
|
+
using _Base::_M_start;
|
107
|
+
using _Base::_M_finish;
|
108
|
+
using _Base::_M_end_of_storage;
|
109
|
+
using _Base::_M_allocate;
|
110
|
+
using _Base::_M_deallocate;
|
111
|
+
typedef typename _Base::allocator_type allocator_type;
|
112
|
+
|
113
|
+
_Vector_base(const allocator_type& __a) : _Base(__a) {}
|
114
|
+
_Vector_base(size_t __n, const allocator_type& __a) : _Base(__a) {
|
115
|
+
_M_start = _M_allocate(__n);
|
116
|
+
_M_finish = _M_start;
|
117
|
+
_M_end_of_storage = _M_start + __n;
|
118
|
+
}
|
119
|
+
|
120
|
+
~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); }
|
121
|
+
};
|
122
|
+
|
123
|
+
#else /* __STL_USE_STD_ALLOCATORS */
|
124
|
+
|
125
|
+
template <class _Tp, class _Alloc>
|
126
|
+
class _Vector_base {
|
127
|
+
public:
|
128
|
+
typedef _Alloc allocator_type;
|
129
|
+
allocator_type get_allocator() const { return allocator_type(); }
|
130
|
+
|
131
|
+
_Vector_base(const _Alloc&)
|
132
|
+
: _M_start(0), _M_finish(0), _M_end_of_storage(0) {}
|
133
|
+
_Vector_base(size_t __n, const _Alloc&)
|
134
|
+
: _M_start(0), _M_finish(0), _M_end_of_storage(0)
|
135
|
+
{
|
136
|
+
_M_start = _M_allocate(__n);
|
137
|
+
_M_finish = _M_start;
|
138
|
+
_M_end_of_storage = _M_start + __n;
|
139
|
+
}
|
140
|
+
|
141
|
+
~_Vector_base() { _M_deallocate(_M_start, _M_end_of_storage - _M_start); }
|
142
|
+
|
143
|
+
protected:
|
144
|
+
_Tp* _M_start;
|
145
|
+
_Tp* _M_finish;
|
146
|
+
_Tp* _M_end_of_storage;
|
147
|
+
|
148
|
+
typedef simple_alloc<_Tp, _Alloc> _M_data_allocator;
|
149
|
+
_Tp* _M_allocate(size_t __n)
|
150
|
+
{ return _M_data_allocator::allocate(__n); }
|
151
|
+
void _M_deallocate(_Tp* __p, size_t __n)
|
152
|
+
{ _M_data_allocator::deallocate(__p, __n); }
|
153
|
+
};
|
154
|
+
|
155
|
+
#endif /* __STL_USE_STD_ALLOCATORS */
|
156
|
+
|
157
|
+
template <class _Tp, class _Alloc = __STL_DEFAULT_ALLOCATOR(_Tp) >
|
158
|
+
class vector : protected _Vector_base<_Tp, _Alloc>
|
159
|
+
{
|
160
|
+
private:
|
161
|
+
typedef _Vector_base<_Tp, _Alloc> _Base;
|
162
|
+
public:
|
163
|
+
typedef _Tp value_type;
|
164
|
+
typedef value_type* pointer;
|
165
|
+
typedef const value_type* const_pointer;
|
166
|
+
typedef value_type* iterator;
|
167
|
+
typedef const value_type* const_iterator;
|
168
|
+
typedef value_type& reference;
|
169
|
+
typedef const value_type& const_reference;
|
170
|
+
typedef size_t size_type;
|
171
|
+
typedef ptrdiff_t difference_type;
|
172
|
+
|
173
|
+
typedef typename _Base::allocator_type allocator_type;
|
174
|
+
allocator_type get_allocator() const { return _Base::get_allocator(); }
|
175
|
+
|
176
|
+
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
|
177
|
+
typedef reverse_iterator<const_iterator> const_reverse_iterator;
|
178
|
+
typedef reverse_iterator<iterator> reverse_iterator;
|
179
|
+
#else /* __STL_CLASS_PARTIAL_SPECIALIZATION */
|
180
|
+
typedef reverse_iterator<const_iterator, value_type, const_reference,
|
181
|
+
difference_type> const_reverse_iterator;
|
182
|
+
typedef reverse_iterator<iterator, value_type, reference, difference_type>
|
183
|
+
reverse_iterator;
|
184
|
+
#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
|
185
|
+
|
186
|
+
protected:
|
187
|
+
#ifdef __STL_HAS_NAMESPACES
|
188
|
+
using _Base::_M_allocate;
|
189
|
+
using _Base::_M_deallocate;
|
190
|
+
using _Base::_M_start;
|
191
|
+
using _Base::_M_finish;
|
192
|
+
using _Base::_M_end_of_storage;
|
193
|
+
#endif /* __STL_HAS_NAMESPACES */
|
194
|
+
|
195
|
+
protected:
|
196
|
+
void _M_insert_aux(iterator __position, const _Tp& __x);
|
197
|
+
void _M_insert_aux(iterator __position);
|
198
|
+
|
199
|
+
public:
|
200
|
+
iterator begin() { return _M_start; }
|
201
|
+
const_iterator begin() const { return _M_start; }
|
202
|
+
iterator end() { return _M_finish; }
|
203
|
+
const_iterator end() const { return _M_finish; }
|
204
|
+
|
205
|
+
reverse_iterator rbegin()
|
206
|
+
{ return reverse_iterator(end()); }
|
207
|
+
const_reverse_iterator rbegin() const
|
208
|
+
{ return const_reverse_iterator(end()); }
|
209
|
+
reverse_iterator rend()
|
210
|
+
{ return reverse_iterator(begin()); }
|
211
|
+
const_reverse_iterator rend() const
|
212
|
+
{ return const_reverse_iterator(begin()); }
|
213
|
+
|
214
|
+
size_type size() const
|
215
|
+
{ return size_type(end() - begin()); }
|
216
|
+
size_type max_size() const
|
217
|
+
{ return size_type(-1) / sizeof(_Tp); }
|
218
|
+
size_type capacity() const
|
219
|
+
{ return size_type(_M_end_of_storage - begin()); }
|
220
|
+
bool empty() const
|
221
|
+
{ return begin() == end(); }
|
222
|
+
|
223
|
+
reference operator[](size_type __n) { return *(begin() + __n); }
|
224
|
+
const_reference operator[](size_type __n) const { return *(begin() + __n); }
|
225
|
+
|
226
|
+
explicit vector(const allocator_type& __a = allocator_type())
|
227
|
+
: _Base(__a) {}
|
228
|
+
|
229
|
+
vector(size_type __n, const _Tp& __value,
|
230
|
+
const allocator_type& __a = allocator_type())
|
231
|
+
: _Base(__n, __a)
|
232
|
+
{ _M_finish = uninitialized_fill_n(_M_start, __n, __value); }
|
233
|
+
|
234
|
+
explicit vector(size_type __n)
|
235
|
+
: _Base(__n, allocator_type())
|
236
|
+
{ _M_finish = uninitialized_fill_n(_M_start, __n, _Tp()); }
|
237
|
+
|
238
|
+
vector(const vector<_Tp, _Alloc>& __x)
|
239
|
+
: _Base(__x.size(), __x.get_allocator())
|
240
|
+
{ _M_finish = uninitialized_copy(__x.begin(), __x.end(), _M_start); }
|
241
|
+
|
242
|
+
#ifdef __STL_MEMBER_TEMPLATES
|
243
|
+
// Check whether it's an integral type. If so, it's not an iterator.
|
244
|
+
template <class _InputIterator>
|
245
|
+
vector(_InputIterator __first, _InputIterator __last,
|
246
|
+
const allocator_type& __a = allocator_type()) : _Base(__a) {
|
247
|
+
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
|
248
|
+
_M_initialize_aux(__first, __last, _Integral());
|
249
|
+
}
|
250
|
+
|
251
|
+
template <class _Integer>
|
252
|
+
void _M_initialize_aux(_Integer __n, _Integer __value, __true_type) {
|
253
|
+
_M_start = _M_allocate(__n);
|
254
|
+
_M_end_of_storage = _M_start + __n;
|
255
|
+
_M_finish = uninitialized_fill_n(_M_start, __n, __value);
|
256
|
+
}
|
257
|
+
|
258
|
+
template <class _InputIterator>
|
259
|
+
void _M_initialize_aux(_InputIterator __first, _InputIterator __last,
|
260
|
+
__false_type) {
|
261
|
+
_M_range_initialize(__first, __last, __ITERATOR_CATEGORY(__first));
|
262
|
+
}
|
263
|
+
|
264
|
+
#else
|
265
|
+
vector(const _Tp* __first, const _Tp* __last,
|
266
|
+
const allocator_type& __a = allocator_type())
|
267
|
+
: _Base(__last - __first, __a)
|
268
|
+
{ _M_finish = uninitialized_copy(__first, __last, _M_start); }
|
269
|
+
#endif /* __STL_MEMBER_TEMPLATES */
|
270
|
+
|
271
|
+
~vector() { destroy(_M_start, _M_finish); }
|
272
|
+
|
273
|
+
vector<_Tp, _Alloc>& operator=(const vector<_Tp, _Alloc>& __x);
|
274
|
+
void reserve(size_type __n) {
|
275
|
+
if (capacity() < __n) {
|
276
|
+
const size_type __old_size = size();
|
277
|
+
iterator __tmp = _M_allocate_and_copy(__n, _M_start, _M_finish);
|
278
|
+
destroy(_M_start, _M_finish);
|
279
|
+
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
|
280
|
+
_M_start = __tmp;
|
281
|
+
_M_finish = __tmp + __old_size;
|
282
|
+
_M_end_of_storage = _M_start + __n;
|
283
|
+
}
|
284
|
+
}
|
285
|
+
|
286
|
+
// assign(), a generalized assignment member function. Two
|
287
|
+
// versions: one that takes a count, and one that takes a range.
|
288
|
+
// The range version is a member template, so we dispatch on whether
|
289
|
+
// or not the type is an integer.
|
290
|
+
|
291
|
+
void assign(size_type __n, const _Tp& __val);
|
292
|
+
|
293
|
+
#ifdef __STL_MEMBER_TEMPLATES
|
294
|
+
|
295
|
+
template <class _InputIterator>
|
296
|
+
void assign(_InputIterator __first, _InputIterator __last) {
|
297
|
+
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
|
298
|
+
_M_assign_dispatch(__first, __last, _Integral());
|
299
|
+
}
|
300
|
+
|
301
|
+
template <class _Integer>
|
302
|
+
void _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
|
303
|
+
{ assign((size_type) __n, (_Tp) __val); }
|
304
|
+
|
305
|
+
template <class _InputIter>
|
306
|
+
void _M_assign_dispatch(_InputIter __first, _InputIter __last, __false_type)
|
307
|
+
{ _M_assign_aux(__first, __last, __ITERATOR_CATEGORY(__first)); }
|
308
|
+
|
309
|
+
template <class _InputIterator>
|
310
|
+
void _M_assign_aux(_InputIterator __first, _InputIterator __last,
|
311
|
+
input_iterator_tag);
|
312
|
+
|
313
|
+
template <class _ForwardIterator>
|
314
|
+
void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
|
315
|
+
forward_iterator_tag);
|
316
|
+
|
317
|
+
#endif /* __STL_MEMBER_TEMPLATES */
|
318
|
+
|
319
|
+
reference front() { return *begin(); }
|
320
|
+
const_reference front() const { return *begin(); }
|
321
|
+
reference back() { return *(end() - 1); }
|
322
|
+
const_reference back() const { return *(end() - 1); }
|
323
|
+
|
324
|
+
void push_back(const _Tp& __x) {
|
325
|
+
if (_M_finish != _M_end_of_storage) {
|
326
|
+
construct(_M_finish, __x);
|
327
|
+
++_M_finish;
|
328
|
+
}
|
329
|
+
else
|
330
|
+
_M_insert_aux(end(), __x);
|
331
|
+
}
|
332
|
+
void push_back() {
|
333
|
+
if (_M_finish != _M_end_of_storage) {
|
334
|
+
construct(_M_finish);
|
335
|
+
++_M_finish;
|
336
|
+
}
|
337
|
+
else
|
338
|
+
_M_insert_aux(end());
|
339
|
+
}
|
340
|
+
void swap(vector<_Tp, _Alloc>& __x) {
|
341
|
+
__STD::swap(_M_start, __x._M_start);
|
342
|
+
__STD::swap(_M_finish, __x._M_finish);
|
343
|
+
__STD::swap(_M_end_of_storage, __x._M_end_of_storage);
|
344
|
+
}
|
345
|
+
|
346
|
+
iterator insert(iterator __position, const _Tp& __x) {
|
347
|
+
size_type __n = __position - begin();
|
348
|
+
if (_M_finish != _M_end_of_storage && __position == end()) {
|
349
|
+
construct(_M_finish, __x);
|
350
|
+
++_M_finish;
|
351
|
+
}
|
352
|
+
else
|
353
|
+
_M_insert_aux(__position, __x);
|
354
|
+
return begin() + __n;
|
355
|
+
}
|
356
|
+
iterator insert(iterator __position) {
|
357
|
+
size_type __n = __position - begin();
|
358
|
+
if (_M_finish != _M_end_of_storage && __position == end()) {
|
359
|
+
construct(_M_finish);
|
360
|
+
++_M_finish;
|
361
|
+
}
|
362
|
+
else
|
363
|
+
_M_insert_aux(__position);
|
364
|
+
return begin() + __n;
|
365
|
+
}
|
366
|
+
#ifdef __STL_MEMBER_TEMPLATES
|
367
|
+
// Check whether it's an integral type. If so, it's not an iterator.
|
368
|
+
template <class _InputIterator>
|
369
|
+
void insert(iterator __pos, _InputIterator __first, _InputIterator __last) {
|
370
|
+
typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
|
371
|
+
_M_insert_dispatch(__pos, __first, __last, _Integral());
|
372
|
+
}
|
373
|
+
|
374
|
+
template <class _Integer>
|
375
|
+
void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
|
376
|
+
__true_type) {
|
377
|
+
insert(__pos, (size_type) __n, (_Tp) __val);
|
378
|
+
}
|
379
|
+
|
380
|
+
template <class _InputIterator>
|
381
|
+
void _M_insert_dispatch(iterator __pos,
|
382
|
+
_InputIterator __first, _InputIterator __last,
|
383
|
+
__false_type) {
|
384
|
+
_M_range_insert(__pos, __first, __last, __ITERATOR_CATEGORY(__first));
|
385
|
+
}
|
386
|
+
#else /* __STL_MEMBER_TEMPLATES */
|
387
|
+
void insert(iterator __position,
|
388
|
+
const_iterator __first, const_iterator __last);
|
389
|
+
#endif /* __STL_MEMBER_TEMPLATES */
|
390
|
+
|
391
|
+
void insert (iterator __pos, size_type __n, const _Tp& __x);
|
392
|
+
|
393
|
+
void pop_back() {
|
394
|
+
--_M_finish;
|
395
|
+
destroy(_M_finish);
|
396
|
+
}
|
397
|
+
iterator erase(iterator __position) {
|
398
|
+
if (__position + 1 != end())
|
399
|
+
copy(__position + 1, _M_finish, __position);
|
400
|
+
--_M_finish;
|
401
|
+
destroy(_M_finish);
|
402
|
+
return __position;
|
403
|
+
}
|
404
|
+
iterator erase(iterator __first, iterator __last) {
|
405
|
+
iterator __i = copy(__last, _M_finish, __first);
|
406
|
+
destroy(__i, _M_finish);
|
407
|
+
_M_finish = _M_finish - (__last - __first);
|
408
|
+
return __first;
|
409
|
+
}
|
410
|
+
|
411
|
+
void resize(size_type __new_size, const _Tp& __x) {
|
412
|
+
if (__new_size < size())
|
413
|
+
erase(begin() + __new_size, end());
|
414
|
+
else
|
415
|
+
insert(end(), __new_size - size(), __x);
|
416
|
+
}
|
417
|
+
void resize(size_type __new_size) { resize(__new_size, _Tp()); }
|
418
|
+
void clear() { erase(begin(), end()); }
|
419
|
+
|
420
|
+
protected:
|
421
|
+
|
422
|
+
#ifdef __STL_MEMBER_TEMPLATES
|
423
|
+
template <class _ForwardIterator>
|
424
|
+
iterator _M_allocate_and_copy(size_type __n, _ForwardIterator __first,
|
425
|
+
_ForwardIterator __last)
|
426
|
+
{
|
427
|
+
iterator __result = _M_allocate(__n);
|
428
|
+
__STL_TRY {
|
429
|
+
uninitialized_copy(__first, __last, __result);
|
430
|
+
return __result;
|
431
|
+
}
|
432
|
+
__STL_UNWIND(_M_deallocate(__result, __n));
|
433
|
+
}
|
434
|
+
#else /* __STL_MEMBER_TEMPLATES */
|
435
|
+
iterator _M_allocate_and_copy(size_type __n, const_iterator __first,
|
436
|
+
const_iterator __last)
|
437
|
+
{
|
438
|
+
iterator __result = _M_allocate(__n);
|
439
|
+
__STL_TRY {
|
440
|
+
uninitialized_copy(__first, __last, __result);
|
441
|
+
return __result;
|
442
|
+
}
|
443
|
+
__STL_UNWIND(_M_deallocate(__result, __n));
|
444
|
+
}
|
445
|
+
#endif /* __STL_MEMBER_TEMPLATES */
|
446
|
+
|
447
|
+
|
448
|
+
#ifdef __STL_MEMBER_TEMPLATES
|
449
|
+
template <class _InputIterator>
|
450
|
+
void _M_range_initialize(_InputIterator __first,
|
451
|
+
_InputIterator __last, input_iterator_tag)
|
452
|
+
{
|
453
|
+
for ( ; __first != __last; ++__first)
|
454
|
+
push_back(*__first);
|
455
|
+
}
|
456
|
+
|
457
|
+
// This function is only called by the constructor.
|
458
|
+
template <class _ForwardIterator>
|
459
|
+
void _M_range_initialize(_ForwardIterator __first,
|
460
|
+
_ForwardIterator __last, forward_iterator_tag)
|
461
|
+
{
|
462
|
+
size_type __n = 0;
|
463
|
+
distance(__first, __last, __n);
|
464
|
+
_M_start = _M_allocate(__n);
|
465
|
+
_M_end_of_storage = _M_start + __n;
|
466
|
+
_M_finish = uninitialized_copy(__first, __last, _M_start);
|
467
|
+
}
|
468
|
+
|
469
|
+
template <class _InputIterator>
|
470
|
+
void _M_range_insert(iterator __pos,
|
471
|
+
_InputIterator __first, _InputIterator __last,
|
472
|
+
input_iterator_tag);
|
473
|
+
|
474
|
+
template <class _ForwardIterator>
|
475
|
+
void _M_range_insert(iterator __pos,
|
476
|
+
_ForwardIterator __first, _ForwardIterator __last,
|
477
|
+
forward_iterator_tag);
|
478
|
+
|
479
|
+
#endif /* __STL_MEMBER_TEMPLATES */
|
480
|
+
};
|
481
|
+
|
482
|
+
template <class _Tp, class _Alloc>
|
483
|
+
inline bool
|
484
|
+
operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
|
485
|
+
{
|
486
|
+
return __x.size() == __y.size() &&
|
487
|
+
equal(__x.begin(), __x.end(), __y.begin());
|
488
|
+
}
|
489
|
+
|
490
|
+
template <class _Tp, class _Alloc>
|
491
|
+
inline bool
|
492
|
+
operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
|
493
|
+
{
|
494
|
+
return lexicographical_compare(__x.begin(), __x.end(),
|
495
|
+
__y.begin(), __y.end());
|
496
|
+
}
|
497
|
+
|
498
|
+
#ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
|
499
|
+
|
500
|
+
template <class _Tp, class _Alloc>
|
501
|
+
inline void swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y)
|
502
|
+
{
|
503
|
+
__x.swap(__y);
|
504
|
+
}
|
505
|
+
|
506
|
+
#endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
|
507
|
+
|
508
|
+
template <class _Tp, class _Alloc>
|
509
|
+
vector<_Tp,_Alloc>&
|
510
|
+
vector<_Tp,_Alloc>::operator=(const vector<_Tp, _Alloc>& __x)
|
511
|
+
{
|
512
|
+
if (&__x != this) {
|
513
|
+
const size_type __xlen = __x.size();
|
514
|
+
if (__xlen > capacity()) {
|
515
|
+
iterator __tmp = _M_allocate_and_copy(__xlen, __x.begin(), __x.end());
|
516
|
+
destroy(_M_start, _M_finish);
|
517
|
+
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
|
518
|
+
_M_start = __tmp;
|
519
|
+
_M_end_of_storage = _M_start + __xlen;
|
520
|
+
}
|
521
|
+
else if (size() >= __xlen) {
|
522
|
+
iterator __i = copy(__x.begin(), __x.end(), begin());
|
523
|
+
destroy(__i, _M_finish);
|
524
|
+
}
|
525
|
+
else {
|
526
|
+
copy(__x.begin(), __x.begin() + size(), _M_start);
|
527
|
+
uninitialized_copy(__x.begin() + size(), __x.end(), _M_finish);
|
528
|
+
}
|
529
|
+
_M_finish = _M_start + __xlen;
|
530
|
+
}
|
531
|
+
return *this;
|
532
|
+
}
|
533
|
+
|
534
|
+
template <class _Tp, class _Alloc>
|
535
|
+
void vector<_Tp, _Alloc>::assign(size_t __n, const value_type& __val) {
|
536
|
+
if (__n > capacity()) {
|
537
|
+
vector<_Tp, _Alloc> __tmp(__n, __val, get_allocator());
|
538
|
+
__tmp.swap(*this);
|
539
|
+
}
|
540
|
+
else if (__n > size()) {
|
541
|
+
fill(begin(), end(), __val);
|
542
|
+
_M_finish = uninitialized_fill_n(_M_finish, __n - size(), __val);
|
543
|
+
}
|
544
|
+
else
|
545
|
+
erase(fill_n(begin(), __n, __val), end());
|
546
|
+
}
|
547
|
+
|
548
|
+
#ifdef __STL_MEMBER_TEMPLATES
|
549
|
+
|
550
|
+
template <class _Tp, class _Alloc> template <class _InputIter>
|
551
|
+
void vector<_Tp, _Alloc>::_M_assign_aux(_InputIter __first, _InputIter __last,
|
552
|
+
input_iterator_tag) {
|
553
|
+
iterator __cur = begin();
|
554
|
+
for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
|
555
|
+
*__cur = *__first;
|
556
|
+
if (__first == __last)
|
557
|
+
erase(__cur, end());
|
558
|
+
else
|
559
|
+
insert(end(), __first, __last);
|
560
|
+
}
|
561
|
+
|
562
|
+
template <class _Tp, class _Alloc> template <class _ForwardIter>
|
563
|
+
void
|
564
|
+
vector<_Tp, _Alloc>::_M_assign_aux(_ForwardIter __first, _ForwardIter __last,
|
565
|
+
forward_iterator_tag) {
|
566
|
+
size_type __len = 0;
|
567
|
+
distance(__first, __last, __len);
|
568
|
+
|
569
|
+
if (__len > capacity()) {
|
570
|
+
iterator __tmp = _M_allocate_and_copy(__len, __first, __last);
|
571
|
+
destroy(_M_start, _M_finish);
|
572
|
+
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
|
573
|
+
_M_start = __tmp;
|
574
|
+
_M_end_of_storage = _M_finish = _M_start + __len;
|
575
|
+
}
|
576
|
+
else if (size() >= __len) {
|
577
|
+
iterator __new_finish = copy(__first, __last, _M_start);
|
578
|
+
destroy(__new_finish, _M_finish);
|
579
|
+
_M_finish = __new_finish;
|
580
|
+
}
|
581
|
+
else {
|
582
|
+
_ForwardIter __mid = __first;
|
583
|
+
advance(__mid, size());
|
584
|
+
copy(__first, __mid, _M_start);
|
585
|
+
_M_finish = uninitialized_copy(__mid, __last, _M_finish);
|
586
|
+
}
|
587
|
+
}
|
588
|
+
|
589
|
+
#endif /* __STL_MEMBER_TEMPLATES */
|
590
|
+
|
591
|
+
template <class _Tp, class _Alloc>
|
592
|
+
void
|
593
|
+
vector<_Tp, _Alloc>::_M_insert_aux(iterator __position, const _Tp& __x)
|
594
|
+
{
|
595
|
+
if (_M_finish != _M_end_of_storage) {
|
596
|
+
construct(_M_finish, *(_M_finish - 1));
|
597
|
+
++_M_finish;
|
598
|
+
_Tp __x_copy = __x;
|
599
|
+
copy_backward(__position, _M_finish - 2, _M_finish - 1);
|
600
|
+
*__position = __x_copy;
|
601
|
+
}
|
602
|
+
else {
|
603
|
+
const size_type __old_size = size();
|
604
|
+
const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
|
605
|
+
iterator __new_start = _M_allocate(__len);
|
606
|
+
iterator __new_finish = __new_start;
|
607
|
+
__STL_TRY {
|
608
|
+
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
|
609
|
+
construct(__new_finish, __x);
|
610
|
+
++__new_finish;
|
611
|
+
__new_finish = uninitialized_copy(__position, _M_finish, __new_finish);
|
612
|
+
}
|
613
|
+
__STL_UNWIND((destroy(__new_start,__new_finish),
|
614
|
+
_M_deallocate(__new_start,__len)));
|
615
|
+
destroy(begin(), end());
|
616
|
+
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
|
617
|
+
_M_start = __new_start;
|
618
|
+
_M_finish = __new_finish;
|
619
|
+
_M_end_of_storage = __new_start + __len;
|
620
|
+
}
|
621
|
+
}
|
622
|
+
|
623
|
+
template <class _Tp, class _Alloc>
|
624
|
+
void
|
625
|
+
vector<_Tp, _Alloc>::_M_insert_aux(iterator __position)
|
626
|
+
{
|
627
|
+
if (_M_finish != _M_end_of_storage) {
|
628
|
+
construct(_M_finish, *(_M_finish - 1));
|
629
|
+
++_M_finish;
|
630
|
+
copy_backward(__position, _M_finish - 2, _M_finish - 1);
|
631
|
+
*__position = _Tp();
|
632
|
+
}
|
633
|
+
else {
|
634
|
+
const size_type __old_size = size();
|
635
|
+
const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
|
636
|
+
iterator __new_start = _M_allocate(__len);
|
637
|
+
iterator __new_finish = __new_start;
|
638
|
+
__STL_TRY {
|
639
|
+
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
|
640
|
+
construct(__new_finish);
|
641
|
+
++__new_finish;
|
642
|
+
__new_finish = uninitialized_copy(__position, _M_finish, __new_finish);
|
643
|
+
}
|
644
|
+
__STL_UNWIND((destroy(__new_start,__new_finish),
|
645
|
+
_M_deallocate(__new_start,__len)));
|
646
|
+
destroy(begin(), end());
|
647
|
+
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
|
648
|
+
_M_start = __new_start;
|
649
|
+
_M_finish = __new_finish;
|
650
|
+
_M_end_of_storage = __new_start + __len;
|
651
|
+
}
|
652
|
+
}
|
653
|
+
|
654
|
+
template <class _Tp, class _Alloc>
|
655
|
+
void vector<_Tp, _Alloc>::insert(iterator __position, size_type __n,
|
656
|
+
const _Tp& __x)
|
657
|
+
{
|
658
|
+
if (__n != 0) {
|
659
|
+
if (size_type(_M_end_of_storage - _M_finish) >= __n) {
|
660
|
+
_Tp __x_copy = __x;
|
661
|
+
const size_type __elems_after = _M_finish - __position;
|
662
|
+
iterator __old_finish = _M_finish;
|
663
|
+
if (__elems_after > __n) {
|
664
|
+
uninitialized_copy(_M_finish - __n, _M_finish, _M_finish);
|
665
|
+
_M_finish += __n;
|
666
|
+
copy_backward(__position, __old_finish - __n, __old_finish);
|
667
|
+
fill(__position, __position + __n, __x_copy);
|
668
|
+
}
|
669
|
+
else {
|
670
|
+
uninitialized_fill_n(_M_finish, __n - __elems_after, __x_copy);
|
671
|
+
_M_finish += __n - __elems_after;
|
672
|
+
uninitialized_copy(__position, __old_finish, _M_finish);
|
673
|
+
_M_finish += __elems_after;
|
674
|
+
fill(__position, __old_finish, __x_copy);
|
675
|
+
}
|
676
|
+
}
|
677
|
+
else {
|
678
|
+
const size_type __old_size = size();
|
679
|
+
const size_type __len = __old_size + max(__old_size, __n);
|
680
|
+
iterator __new_start = _M_allocate(__len);
|
681
|
+
iterator __new_finish = __new_start;
|
682
|
+
__STL_TRY {
|
683
|
+
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
|
684
|
+
__new_finish = uninitialized_fill_n(__new_finish, __n, __x);
|
685
|
+
__new_finish
|
686
|
+
= uninitialized_copy(__position, _M_finish, __new_finish);
|
687
|
+
}
|
688
|
+
__STL_UNWIND((destroy(__new_start,__new_finish),
|
689
|
+
_M_deallocate(__new_start,__len)));
|
690
|
+
destroy(_M_start, _M_finish);
|
691
|
+
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
|
692
|
+
_M_start = __new_start;
|
693
|
+
_M_finish = __new_finish;
|
694
|
+
_M_end_of_storage = __new_start + __len;
|
695
|
+
}
|
696
|
+
}
|
697
|
+
}
|
698
|
+
|
699
|
+
#ifdef __STL_MEMBER_TEMPLATES
|
700
|
+
|
701
|
+
template <class _Tp, class _Alloc> template <class _InputIterator>
|
702
|
+
void
|
703
|
+
vector<_Tp, _Alloc>::_M_range_insert(iterator __pos,
|
704
|
+
_InputIterator __first,
|
705
|
+
_InputIterator __last,
|
706
|
+
input_iterator_tag)
|
707
|
+
{
|
708
|
+
for ( ; __first != __last; ++__first) {
|
709
|
+
__pos = insert(__pos, *__first);
|
710
|
+
++__pos;
|
711
|
+
}
|
712
|
+
}
|
713
|
+
|
714
|
+
template <class _Tp, class _Alloc> template <class _ForwardIterator>
|
715
|
+
void
|
716
|
+
vector<_Tp, _Alloc>::_M_range_insert(iterator __position,
|
717
|
+
_ForwardIterator __first,
|
718
|
+
_ForwardIterator __last,
|
719
|
+
forward_iterator_tag)
|
720
|
+
{
|
721
|
+
if (__first != __last) {
|
722
|
+
size_type __n = 0;
|
723
|
+
distance(__first, __last, __n);
|
724
|
+
if (size_type(_M_end_of_storage - _M_finish) >= __n) {
|
725
|
+
const size_type __elems_after = _M_finish - __position;
|
726
|
+
iterator __old_finish = _M_finish;
|
727
|
+
if (__elems_after > __n) {
|
728
|
+
uninitialized_copy(_M_finish - __n, _M_finish, _M_finish);
|
729
|
+
_M_finish += __n;
|
730
|
+
copy_backward(__position, __old_finish - __n, __old_finish);
|
731
|
+
copy(__first, __last, __position);
|
732
|
+
}
|
733
|
+
else {
|
734
|
+
_ForwardIterator __mid = __first;
|
735
|
+
advance(__mid, __elems_after);
|
736
|
+
uninitialized_copy(__mid, __last, _M_finish);
|
737
|
+
_M_finish += __n - __elems_after;
|
738
|
+
uninitialized_copy(__position, __old_finish, _M_finish);
|
739
|
+
_M_finish += __elems_after;
|
740
|
+
copy(__first, __mid, __position);
|
741
|
+
}
|
742
|
+
}
|
743
|
+
else {
|
744
|
+
const size_type __old_size = size();
|
745
|
+
const size_type __len = __old_size + max(__old_size, __n);
|
746
|
+
iterator __new_start = _M_allocate(__len);
|
747
|
+
iterator __new_finish = __new_start;
|
748
|
+
__STL_TRY {
|
749
|
+
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
|
750
|
+
__new_finish = uninitialized_copy(__first, __last, __new_finish);
|
751
|
+
__new_finish
|
752
|
+
= uninitialized_copy(__position, _M_finish, __new_finish);
|
753
|
+
}
|
754
|
+
__STL_UNWIND((destroy(__new_start,__new_finish),
|
755
|
+
_M_deallocate(__new_start,__len)));
|
756
|
+
destroy(_M_start, _M_finish);
|
757
|
+
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
|
758
|
+
_M_start = __new_start;
|
759
|
+
_M_finish = __new_finish;
|
760
|
+
_M_end_of_storage = __new_start + __len;
|
761
|
+
}
|
762
|
+
}
|
763
|
+
}
|
764
|
+
|
765
|
+
#else /* __STL_MEMBER_TEMPLATES */
|
766
|
+
|
767
|
+
template <class _Tp, class _Alloc>
|
768
|
+
void
|
769
|
+
vector<_Tp, _Alloc>::insert(iterator __position,
|
770
|
+
const_iterator __first,
|
771
|
+
const_iterator __last)
|
772
|
+
{
|
773
|
+
if (__first != __last) {
|
774
|
+
size_type __n = 0;
|
775
|
+
distance(__first, __last, __n);
|
776
|
+
if (size_type(_M_end_of_storage - _M_finish) >= __n) {
|
777
|
+
const size_type __elems_after = _M_finish - __position;
|
778
|
+
iterator __old_finish = _M_finish;
|
779
|
+
if (__elems_after > __n) {
|
780
|
+
uninitialized_copy(_M_finish - __n, _M_finish, _M_finish);
|
781
|
+
_M_finish += __n;
|
782
|
+
copy_backward(__position, __old_finish - __n, __old_finish);
|
783
|
+
copy(__first, __last, __position);
|
784
|
+
}
|
785
|
+
else {
|
786
|
+
uninitialized_copy(__first + __elems_after, __last, _M_finish);
|
787
|
+
_M_finish += __n - __elems_after;
|
788
|
+
uninitialized_copy(__position, __old_finish, _M_finish);
|
789
|
+
_M_finish += __elems_after;
|
790
|
+
copy(__first, __first + __elems_after, __position);
|
791
|
+
}
|
792
|
+
}
|
793
|
+
else {
|
794
|
+
const size_type __old_size = size();
|
795
|
+
const size_type __len = __old_size + max(__old_size, __n);
|
796
|
+
iterator __new_start = _M_allocate(__len);
|
797
|
+
iterator __new_finish = __new_start;
|
798
|
+
__STL_TRY {
|
799
|
+
__new_finish = uninitialized_copy(_M_start, __position, __new_start);
|
800
|
+
__new_finish = uninitialized_copy(__first, __last, __new_finish);
|
801
|
+
__new_finish
|
802
|
+
= uninitialized_copy(__position, _M_finish, __new_finish);
|
803
|
+
}
|
804
|
+
__STL_UNWIND((destroy(__new_start,__new_finish),
|
805
|
+
_M_deallocate(__new_start,__len)));
|
806
|
+
destroy(_M_start, _M_finish);
|
807
|
+
_M_deallocate(_M_start, _M_end_of_storage - _M_start);
|
808
|
+
_M_start = __new_start;
|
809
|
+
_M_finish = __new_finish;
|
810
|
+
_M_end_of_storage = __new_start + __len;
|
811
|
+
}
|
812
|
+
}
|
813
|
+
}
|
814
|
+
|
815
|
+
#endif /* __STL_MEMBER_TEMPLATES */
|
816
|
+
|
817
|
+
#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
|
818
|
+
#pragma reset woff 1174
|
819
|
+
#pragma reset woff 1375
|
820
|
+
#endif
|
821
|
+
|
822
|
+
__STL_END_NAMESPACE
|
823
|
+
|
824
|
+
#endif /* __SGI_STL_INTERNAL_VECTOR_H */
|
825
|
+
|
826
|
+
// Local Variables:
|
827
|
+
// mode:C++
|
828
|
+
// End:
|