gccxml_gem 0.9.2-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +84 -0
- data/bin/gccxml.exe +0 -0
- data/bin/gccxml_cc1plus.exe +0 -0
- data/bin/gccxml_vcconfig.bat +52 -0
- data/bin/gccxml_vcconfig.exe +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/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/gthr-default.h +581 -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 +664 -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/4.3/gccxml_builtins.h +182 -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/VcInstall/vc6Include.patch +4560 -0
- data/share/gccxml-0.9/VcInstall/vc71Include.patch +921 -0
- data/share/gccxml-0.9/VcInstall/vc71PlatformSDK.patch +146 -0
- data/share/gccxml-0.9/VcInstall/vc7Include.patch +1139 -0
- data/share/gccxml-0.9/VcInstall/vc7PlatformSDK.patch +146 -0
- data/share/gccxml-0.9/VcInstall/vc8ExpressInclude.patch +1887 -0
- data/share/gccxml-0.9/VcInstall/vc8ExpressPlatformSDK.patch +252 -0
- data/share/gccxml-0.9/VcInstall/vc8Include.patch +1887 -0
- data/share/gccxml-0.9/VcInstall/vc8PlatformSDK.patch +252 -0
- data/share/gccxml-0.9/VcInstall/vc8sp1ExpressInclude.patch +1941 -0
- data/share/gccxml-0.9/VcInstall/vc8sp1Include.patch +1970 -0
- data/share/gccxml-0.9/VcInstall/vc8sp1PlatformSDK.patch +252 -0
- data/share/gccxml-0.9/VcInstall/vc9Include.patch +2047 -0
- data/share/gccxml-0.9/VcInstall/vc9PlatformSDK.patch +383 -0
- data/share/gccxml-0.9/VcInstall/vc9sp1Include.patch +2565 -0
- data/share/gccxml-0.9/VcInstall/vcCat.exe +0 -0
- data/share/gccxml-0.9/VcInstall/vcCat.readme.txt +3 -0
- data/share/gccxml-0.9/VcInstall/vcPatch.exe +0 -0
- data/share/gccxml-0.9/VcInstall/vcPatch.readme.txt +27 -0
- data/share/gccxml-0.9/VcInstall/vc_helper +1 -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 +331 -0
@@ -0,0 +1,1457 @@
|
|
1
|
+
#ifndef __VECTOR_H
|
2
|
+
#define __VECTOR_H
|
3
|
+
#pragma option push -b -a8 -pc -Vx- -Ve- -A- -w-inl -w-aus -w-sig
|
4
|
+
// -*- C++ -*-
|
5
|
+
/***************************************************************************
|
6
|
+
*
|
7
|
+
* vector - declarations for the Standard Library vector class
|
8
|
+
*
|
9
|
+
***************************************************************************
|
10
|
+
*
|
11
|
+
* Copyright (c) 1994
|
12
|
+
* Hewlett-Packard Company
|
13
|
+
*
|
14
|
+
* Permission to use, copy, modify, distribute and sell this software
|
15
|
+
* and its documentation for any purpose is hereby granted without fee,
|
16
|
+
* provided that the above copyright notice appear in all copies and
|
17
|
+
* that both that copyright notice and this permission notice appear
|
18
|
+
* in supporting documentation. Hewlett-Packard Company makes no
|
19
|
+
* representations about the suitability of this software for any
|
20
|
+
* purpose. It is provided "as is" without express or implied warranty.
|
21
|
+
*
|
22
|
+
*
|
23
|
+
***************************************************************************
|
24
|
+
*
|
25
|
+
* Copyright (c) 1994-1999 Rogue Wave Software, Inc. All Rights Reserved.
|
26
|
+
*
|
27
|
+
* This computer software is owned by Rogue Wave Software, Inc. and is
|
28
|
+
* protected by U.S. copyright laws and other laws and by international
|
29
|
+
* treaties. This computer software is furnished by Rogue Wave Software,
|
30
|
+
* Inc. pursuant to a written license agreement and may be used, copied,
|
31
|
+
* transmitted, and stored only in accordance with the terms of such
|
32
|
+
* license and with the inclusion of the above copyright notice. This
|
33
|
+
* computer software or any other copies thereof may not be provided or
|
34
|
+
* otherwise made available to any other person.
|
35
|
+
*
|
36
|
+
* U.S. Government Restricted Rights. This computer software is provided
|
37
|
+
* with Restricted Rights. Use, duplication, or disclosure by the
|
38
|
+
* Government is subject to restrictions as set forth in subparagraph (c)
|
39
|
+
* (1) (ii) of The Rights in Technical Data and Computer Software clause
|
40
|
+
* at DFARS 252.227-7013 or subparagraphs (c) (1) and (2) of the
|
41
|
+
* Commercial Computer Software � Restricted Rights at 48 CFR 52.227-19,
|
42
|
+
* as applicable. Manufacturer is Rogue Wave Software, Inc., 5500
|
43
|
+
* Flatiron Parkway, Boulder, Colorado 80301 USA.
|
44
|
+
*
|
45
|
+
**************************************************************************/
|
46
|
+
|
47
|
+
#ifndef __STD_VECTOR__
|
48
|
+
#define __STD_VECTOR__
|
49
|
+
|
50
|
+
#include <stdcomp.h>
|
51
|
+
#include <rw/stddefs.h>
|
52
|
+
#include <rw/rwdispatch.h>
|
53
|
+
|
54
|
+
#include <algorithm>
|
55
|
+
#include <iterator>
|
56
|
+
#include <memory>
|
57
|
+
#include <stdexcept>
|
58
|
+
|
59
|
+
#ifndef vector
|
60
|
+
#define vector vector
|
61
|
+
#endif
|
62
|
+
|
63
|
+
#ifndef _RWSTD_NO_NAMESPACE
|
64
|
+
namespace std {
|
65
|
+
#endif
|
66
|
+
|
67
|
+
//
|
68
|
+
// Note that _RWSTD_COMPLEX_DEFAULT(x)
|
69
|
+
// will expand to: ' = x', or nothing,
|
70
|
+
// depending on your compiler's capabilities and/or
|
71
|
+
// flag settings (see stdcomp.h).
|
72
|
+
//
|
73
|
+
template <class T, class Allocator _RWSTD_COMPLEX_DEFAULT(allocator<T>) >
|
74
|
+
class vector
|
75
|
+
{
|
76
|
+
|
77
|
+
private:
|
78
|
+
#if defined( _RWSTD_ALLOCATOR) && !defined(_HPACC_)
|
79
|
+
typedef _TYPENAME Allocator::template rebind<T>::other __value_alloc_type;
|
80
|
+
#else
|
81
|
+
typedef allocator_interface<Allocator,T> __value_alloc_type;
|
82
|
+
#endif
|
83
|
+
|
84
|
+
public:
|
85
|
+
//
|
86
|
+
// Types.
|
87
|
+
//
|
88
|
+
typedef T value_type;
|
89
|
+
typedef Allocator allocator_type;
|
90
|
+
|
91
|
+
#ifndef _RWSTD_NO_COMPLICATED_TYPEDEF
|
92
|
+
typedef _TYPENAME _RWSTD_ALLOC_SIZE_TYPE size_type;
|
93
|
+
typedef _TYPENAME _RWSTD_ALLOC_DIFF_TYPE difference_type;
|
94
|
+
typedef _TYPENAME __value_alloc_type::pointer iterator;
|
95
|
+
typedef _TYPENAME __value_alloc_type::const_pointer const_iterator;
|
96
|
+
typedef _TYPENAME __value_alloc_type::reference reference;
|
97
|
+
typedef _TYPENAME __value_alloc_type::const_reference const_reference;
|
98
|
+
typedef _TYPENAME __value_alloc_type::pointer pointer;
|
99
|
+
typedef _TYPENAME __value_alloc_type::const_pointer const_pointer;
|
100
|
+
#else
|
101
|
+
typedef size_t size_type;
|
102
|
+
typedef ptrdiff_t difference_type;
|
103
|
+
typedef T* iterator;
|
104
|
+
typedef const T* const_iterator;
|
105
|
+
typedef T& reference;
|
106
|
+
typedef const T& const_reference;
|
107
|
+
typedef T* pointer;
|
108
|
+
typedef const T* const_pointer;
|
109
|
+
#endif //_RWSTD_NO_COMPLICATED_TYPEDEF
|
110
|
+
|
111
|
+
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
112
|
+
typedef _RW_STD::reverse_iterator<const_iterator> const_reverse_iterator;
|
113
|
+
typedef _RW_STD::reverse_iterator<iterator> reverse_iterator;
|
114
|
+
#else
|
115
|
+
typedef _RW_STD::reverse_iterator<const_iterator,
|
116
|
+
random_access_iterator_tag, value_type,
|
117
|
+
const_reference, const_pointer, difference_type>
|
118
|
+
const_reverse_iterator;
|
119
|
+
typedef _RW_STD::reverse_iterator<iterator,
|
120
|
+
random_access_iterator_tag, value_type,
|
121
|
+
reference, pointer, difference_type>
|
122
|
+
reverse_iterator;
|
123
|
+
#endif
|
124
|
+
|
125
|
+
protected:
|
126
|
+
|
127
|
+
size_type __buffer_size;
|
128
|
+
iterator __start;
|
129
|
+
iterator __finish;
|
130
|
+
__RWSTD::__rw_basis<iterator,allocator_type> __end_of_storage;
|
131
|
+
|
132
|
+
void __insert_aux (iterator position, const T& x);
|
133
|
+
void __insert_aux (iterator position, size_type n, const T& x);
|
134
|
+
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
135
|
+
template<class InputIterator>
|
136
|
+
void __insert_aux (iterator position, InputIterator first, InputIterator last, _RW_is_not_integer)
|
137
|
+
{ __insert_aux2 (position, first, last); }
|
138
|
+
template<class InputIterator>
|
139
|
+
void __insert_aux (iterator position, InputIterator first, InputIterator last, _RW_is_integer)
|
140
|
+
{ __insert_aux (position, (size_type)first, last); }
|
141
|
+
template<class InputIterator>
|
142
|
+
void __insert_aux2 (iterator position, InputIterator first, InputIterator last);
|
143
|
+
#else
|
144
|
+
void __insert_aux2 (iterator position, const_iterator first, const_iterator last);
|
145
|
+
#endif
|
146
|
+
|
147
|
+
void __destroy(iterator start, iterator finish)
|
148
|
+
{
|
149
|
+
while ( start != finish)
|
150
|
+
__value_alloc_type(__end_of_storage).destroy(start++);
|
151
|
+
}
|
152
|
+
|
153
|
+
//
|
154
|
+
// Allocate buffers and fill with n values
|
155
|
+
//
|
156
|
+
void __initn(size_type n, const T& value)
|
157
|
+
{
|
158
|
+
__init();
|
159
|
+
__start = __value_alloc_type(__end_of_storage).allocate(n,0);
|
160
|
+
#ifndef _RWSTD_NO_EXCEPTIONS
|
161
|
+
try {
|
162
|
+
uninitialized_fill_n(__start, n, value);
|
163
|
+
} catch(...) {
|
164
|
+
__value_alloc_type(__end_of_storage).deallocate(__start,n);
|
165
|
+
throw;
|
166
|
+
}
|
167
|
+
#else
|
168
|
+
uninitialized_fill_n(__start, n, value);
|
169
|
+
#endif // _RWSTD_NO_EXCEPTIONS
|
170
|
+
__finish = __start + n;
|
171
|
+
__end_of_storage = __finish;
|
172
|
+
}
|
173
|
+
|
174
|
+
void __init()
|
175
|
+
{
|
176
|
+
__buffer_size =
|
177
|
+
max((size_type)1,__RWSTD::__rw_allocation_size((value_type*)0,(size_type)0,(size_type)0));
|
178
|
+
}
|
179
|
+
public:
|
180
|
+
//
|
181
|
+
// construct/copy/destroy
|
182
|
+
//
|
183
|
+
_EXPLICIT vector (const Allocator& alloc _RWSTD_DEFAULT_ARG(Allocator()))
|
184
|
+
: __start(0), __finish(0), __end_of_storage(0,alloc)
|
185
|
+
{
|
186
|
+
__init();
|
187
|
+
}
|
188
|
+
|
189
|
+
#ifdef _RWSTD_NO_DEFAULT_TEMPLATE_ARGS
|
190
|
+
vector (void)
|
191
|
+
: __start(0), __finish(0), __end_of_storage(0,Allocator())
|
192
|
+
{ ; }
|
193
|
+
|
194
|
+
vector (size_type n, const T& value)
|
195
|
+
: __start(0), __finish(0), __end_of_storage(0,Allocator())
|
196
|
+
{
|
197
|
+
__initn(n,value);
|
198
|
+
}
|
199
|
+
#endif
|
200
|
+
|
201
|
+
_EXPLICIT vector (size_type n)
|
202
|
+
: __start(0), __finish(0), __end_of_storage(0,Allocator())
|
203
|
+
{
|
204
|
+
T value = T();
|
205
|
+
__initn(n,value);
|
206
|
+
}
|
207
|
+
|
208
|
+
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
209
|
+
|
210
|
+
template<class InputIterator>
|
211
|
+
void __init_aux (InputIterator first, InputIterator last, _RW_is_not_integer)
|
212
|
+
{
|
213
|
+
if (__is_input_iterator(__iterator_category(first))) {
|
214
|
+
copy(first, last, back_inserter(*this));
|
215
|
+
} else {
|
216
|
+
size_type n;
|
217
|
+
__init();
|
218
|
+
__initialize(n, size_type(0));
|
219
|
+
distance(first, last, n);
|
220
|
+
__start = __value_alloc_type(__end_of_storage).allocate(n,0);
|
221
|
+
#ifndef _RWSTD_NO_EXCEPTIONS
|
222
|
+
try {
|
223
|
+
__finish = uninitialized_copy(first, last, __start);
|
224
|
+
} catch(...) {
|
225
|
+
__value_alloc_type(__end_of_storage).deallocate(__start,n);
|
226
|
+
throw;
|
227
|
+
}
|
228
|
+
#else
|
229
|
+
__finish = uninitialized_copy(first, last, __start);
|
230
|
+
#endif // _RWSTD_NO_EXCEPTIONS
|
231
|
+
__end_of_storage = __finish;
|
232
|
+
}
|
233
|
+
}
|
234
|
+
template<class InputIterator>
|
235
|
+
void __init_aux (InputIterator first, InputIterator last, _RW_is_integer)
|
236
|
+
{ __initn((size_type)first,last); }
|
237
|
+
|
238
|
+
template<class InputIterator>
|
239
|
+
vector (InputIterator first, InputIterator last,
|
240
|
+
const Allocator& alloc _RWSTD_DEFAULT_ARG(Allocator()))
|
241
|
+
: __start(0), __finish(0), __end_of_storage(0,alloc)
|
242
|
+
{
|
243
|
+
typedef _TYPENAME _RWdispatch<InputIterator>::_RWtype _RWtype;
|
244
|
+
__init_aux(first, last, _RWtype());
|
245
|
+
}
|
246
|
+
vector (size_type n, const T& value,
|
247
|
+
const Allocator& alloc _RWSTD_DEFAULT_ARG(Allocator()))
|
248
|
+
: __start(0), __finish(0), __end_of_storage(0,alloc)
|
249
|
+
{ __initn((size_type)n,value); }
|
250
|
+
#else
|
251
|
+
//
|
252
|
+
// Build a vector of size n with each element set to copy of value.
|
253
|
+
//
|
254
|
+
vector (size_type n, const T& value,
|
255
|
+
const Allocator& alloc _RWSTD_DEFAULT_ARG(Allocator()))
|
256
|
+
: __start(0), __finish(0), __end_of_storage(0,alloc)
|
257
|
+
{
|
258
|
+
__initn(n,value);
|
259
|
+
}
|
260
|
+
|
261
|
+
vector (const_iterator first, const_iterator last,
|
262
|
+
const Allocator& alloc _RWSTD_DEFAULT_ARG(Allocator()))
|
263
|
+
: __start(0), __finish(0), __end_of_storage(0,alloc)
|
264
|
+
{
|
265
|
+
size_type n;
|
266
|
+
__init();
|
267
|
+
__initialize(n, size_type(0));
|
268
|
+
distance(first, last, n);
|
269
|
+
__start = __value_alloc_type(__end_of_storage).allocate(n,0);
|
270
|
+
#ifndef _RWSTD_NO_EXCEPTIONS
|
271
|
+
try {
|
272
|
+
__finish = uninitialized_copy(first, last, __start);
|
273
|
+
} catch(...) {
|
274
|
+
__value_alloc_type(__end_of_storage).deallocate(__start,n);
|
275
|
+
throw;
|
276
|
+
}
|
277
|
+
#else
|
278
|
+
__finish = uninitialized_copy(first, last, __start);
|
279
|
+
#endif // _RWSTD_NO_EXCEPTIONS
|
280
|
+
__end_of_storage = __finish;
|
281
|
+
}
|
282
|
+
|
283
|
+
#ifdef _RWSTD_NO_DEFAULT_TEMPLATE_ARGS
|
284
|
+
vector (const_iterator first, const_iterator last)
|
285
|
+
: __start(0), __finish(0), __end_of_storage(0,Allocator())
|
286
|
+
{
|
287
|
+
size_type n;
|
288
|
+
__init();
|
289
|
+
__initialize(n, size_type(0));
|
290
|
+
distance(first, last, n);
|
291
|
+
__start = __value_alloc_type(__end_of_storage).allocate(n,0);
|
292
|
+
#ifndef _RWSTD_NO_EXCEPTIONS
|
293
|
+
try {
|
294
|
+
__finish = uninitialized_copy(first, last, __start);
|
295
|
+
} catch(...) {
|
296
|
+
__value_alloc_type(__end_of_storage).deallocate(__start,n);
|
297
|
+
throw;
|
298
|
+
}
|
299
|
+
#else
|
300
|
+
__finish = uninitialized_copy(first, last, __start);
|
301
|
+
#endif // _RWSTD_NO_EXCEPTIONS
|
302
|
+
__end_of_storage = __finish;
|
303
|
+
}
|
304
|
+
#endif // _RWSTD_NO_DEFAULT_TEMPLATE_ARGS
|
305
|
+
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
306
|
+
|
307
|
+
vector (const vector<T,Allocator>& x)
|
308
|
+
: __start(0), __finish(0), __end_of_storage(0,x.get_allocator())
|
309
|
+
{
|
310
|
+
__init();
|
311
|
+
__start = __value_alloc_type(__end_of_storage).allocate(x.end() - x.begin(),0);
|
312
|
+
__finish = uninitialized_copy(x.begin(), x.end(), __start);
|
313
|
+
__end_of_storage = __finish;
|
314
|
+
}
|
315
|
+
|
316
|
+
~vector ()
|
317
|
+
{
|
318
|
+
__destroy(__start, __finish);
|
319
|
+
__value_alloc_type(__end_of_storage).deallocate(__start,__end_of_storage.data()-__start);
|
320
|
+
}
|
321
|
+
|
322
|
+
vector<T,Allocator>& operator= (const vector<T,Allocator>& x);
|
323
|
+
|
324
|
+
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
325
|
+
template<class InputIterator>
|
326
|
+
void assign (InputIterator first, InputIterator last)
|
327
|
+
{
|
328
|
+
erase(begin(), end());
|
329
|
+
typedef _TYPENAME _RWdispatch<InputIterator>::_RWtype _RWtype;
|
330
|
+
__insert_aux(begin(), first, last, _RWtype());
|
331
|
+
}
|
332
|
+
void assign (size_type n, const T& t)
|
333
|
+
{
|
334
|
+
erase(begin(), end()); insert(begin(), n, t);
|
335
|
+
}
|
336
|
+
#else
|
337
|
+
void assign (const_iterator first, const_iterator last)
|
338
|
+
{ erase(begin(), end()); insert(begin(), first, last); }
|
339
|
+
//
|
340
|
+
// Assign n copies of t to this vector.
|
341
|
+
//
|
342
|
+
void assign (size_type n, const T& t)
|
343
|
+
{ erase(begin(), end()); insert(begin(), n, t); }
|
344
|
+
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
345
|
+
|
346
|
+
allocator_type get_allocator() const
|
347
|
+
{
|
348
|
+
return (allocator_type)__end_of_storage;
|
349
|
+
}
|
350
|
+
|
351
|
+
//
|
352
|
+
// Iterators.
|
353
|
+
//
|
354
|
+
iterator begin () { return __start; }
|
355
|
+
const_iterator begin () const { return __start; }
|
356
|
+
iterator end () { return __finish; }
|
357
|
+
const_iterator end () const { return __finish; }
|
358
|
+
|
359
|
+
reverse_iterator rbegin ()
|
360
|
+
{
|
361
|
+
reverse_iterator tmp(end()); return tmp;
|
362
|
+
}
|
363
|
+
const_reverse_iterator rbegin () const
|
364
|
+
{
|
365
|
+
const_reverse_iterator tmp(end()); return tmp;
|
366
|
+
}
|
367
|
+
reverse_iterator rend ()
|
368
|
+
{
|
369
|
+
reverse_iterator tmp(begin()); return tmp;
|
370
|
+
}
|
371
|
+
const_reverse_iterator rend () const
|
372
|
+
{
|
373
|
+
const_reverse_iterator tmp(begin()); return tmp;
|
374
|
+
}
|
375
|
+
|
376
|
+
//
|
377
|
+
// Capacity.
|
378
|
+
//
|
379
|
+
size_type size () const { return size_type(end() - begin()); }
|
380
|
+
size_type max_size () const { return __value_alloc_type(__end_of_storage).max_size(); }
|
381
|
+
void resize (size_type new_size);
|
382
|
+
void resize (size_type new_size, T value);
|
383
|
+
|
384
|
+
size_type capacity () const { return size_type(__end_of_storage.data() - begin()); }
|
385
|
+
bool empty () const { return begin() == end(); }
|
386
|
+
void reserve (size_type n)
|
387
|
+
{
|
388
|
+
_RWSTD_THROW(n > max_size(), length_error,
|
389
|
+
__RWSTD::except_msg_string(__RWSTD::__rwse_InvalidSizeParam,
|
390
|
+
"vector::reserve(size_t)",n,max_size()).msgstr());
|
391
|
+
|
392
|
+
if (capacity() < n)
|
393
|
+
{
|
394
|
+
__value_alloc_type va(__end_of_storage);
|
395
|
+
iterator tmp = va.allocate(n,__start);
|
396
|
+
#ifndef _RWSTD_NO_EXCEPTIONS
|
397
|
+
try {
|
398
|
+
uninitialized_copy(begin(), end(), tmp);
|
399
|
+
} catch(...) {
|
400
|
+
__value_alloc_type(__end_of_storage).deallocate(tmp,n);
|
401
|
+
throw;
|
402
|
+
}
|
403
|
+
#else
|
404
|
+
uninitialized_copy(begin(), end(), tmp);
|
405
|
+
#endif // _RWSTD_NO_EXCEPTIONS
|
406
|
+
int tmp_size = size(); // RW_BUG: Fix for bts-78394
|
407
|
+
__destroy(__start, __finish);
|
408
|
+
va.deallocate(__start,__end_of_storage.data()-__start);
|
409
|
+
__finish = tmp + tmp_size; // RW_BUG: Fix for bts-78394
|
410
|
+
__start = tmp;
|
411
|
+
__end_of_storage = begin() + n;
|
412
|
+
}
|
413
|
+
}
|
414
|
+
|
415
|
+
//
|
416
|
+
// Element access.
|
417
|
+
//
|
418
|
+
reference operator[] (size_type n)
|
419
|
+
{
|
420
|
+
#ifdef _RWSTD_BOUNDS_CHECKING
|
421
|
+
_RWSTD_THROW(n >= size(), out_of_range,
|
422
|
+
__RWSTD::except_msg_string(__RWSTD::rwse_OutOfRange,
|
423
|
+
"vector::operator[](size_t)",n,size()).msgstr());
|
424
|
+
#endif
|
425
|
+
return *(begin() + n);
|
426
|
+
|
427
|
+
}
|
428
|
+
|
429
|
+
const_reference operator[] (size_type n) const
|
430
|
+
{
|
431
|
+
#ifdef _RWSTD_BOUNDS_CHECKING
|
432
|
+
_RWSTD_THROW(n >= size(), out_of_range,
|
433
|
+
__RWSTD::except_msg_string(__RWSTD::rwse_OutOfRange,
|
434
|
+
"vector::operator[](size_t) const",n,size()).msgstr());
|
435
|
+
#endif
|
436
|
+
return *(begin() + n);
|
437
|
+
}
|
438
|
+
|
439
|
+
reference at (size_type n)
|
440
|
+
{
|
441
|
+
_RWSTD_THROW(n >= size(), out_of_range,
|
442
|
+
__RWSTD::except_msg_string(__RWSTD::rwse_OutOfRange,
|
443
|
+
"vector:: at(size_t)",n,size()).msgstr());
|
444
|
+
return *(begin() + n);
|
445
|
+
}
|
446
|
+
const_reference at (size_type n) const
|
447
|
+
{
|
448
|
+
_RWSTD_THROW(n >= size(), out_of_range,
|
449
|
+
__RWSTD::except_msg_string(__RWSTD::rwse_OutOfRange,
|
450
|
+
"vector:: at(size_t) const",n,size()).msgstr());
|
451
|
+
return *(begin() + n);
|
452
|
+
}
|
453
|
+
reference front () { return *begin(); }
|
454
|
+
const_reference front () const { return *begin(); }
|
455
|
+
reference back () { return *(end() - 1); }
|
456
|
+
const_reference back () const { return *(end() - 1); }
|
457
|
+
|
458
|
+
//
|
459
|
+
// Modifiers.
|
460
|
+
//
|
461
|
+
void push_back (const T& x)
|
462
|
+
{
|
463
|
+
if (__finish != __end_of_storage.data())
|
464
|
+
{
|
465
|
+
__value_alloc_type(__end_of_storage).construct(__finish, x);
|
466
|
+
__finish++;
|
467
|
+
}
|
468
|
+
else
|
469
|
+
__insert_aux(end(), x);
|
470
|
+
}
|
471
|
+
void pop_back()
|
472
|
+
{
|
473
|
+
--__finish;
|
474
|
+
__value_alloc_type(__end_of_storage).destroy(__finish);
|
475
|
+
}
|
476
|
+
|
477
|
+
//
|
478
|
+
// Insert x at position.
|
479
|
+
//
|
480
|
+
iterator insert (iterator position, const T& x)
|
481
|
+
{
|
482
|
+
size_type n = position - begin();
|
483
|
+
if (__finish != __end_of_storage.data() && position == end())
|
484
|
+
{
|
485
|
+
__value_alloc_type(__end_of_storage).construct(__finish, x); __finish++;
|
486
|
+
}
|
487
|
+
else
|
488
|
+
__insert_aux(position, x);
|
489
|
+
return begin() + n;
|
490
|
+
}
|
491
|
+
|
492
|
+
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
493
|
+
template<class InputIterator>
|
494
|
+
void insert (iterator position, InputIterator first,
|
495
|
+
InputIterator last)
|
496
|
+
{
|
497
|
+
typedef _TYPENAME _RWdispatch<InputIterator>::_RWtype _RWtype;
|
498
|
+
__insert_aux(position, first, last, _RWtype());
|
499
|
+
}
|
500
|
+
void insert (iterator position, size_type n, const T& value)
|
501
|
+
{ __insert_aux(position,n,value); }
|
502
|
+
#else
|
503
|
+
void insert (iterator position, size_type n, const T& x)
|
504
|
+
{ __insert_aux(position,n,x); }
|
505
|
+
void insert (iterator position, const_iterator first, const_iterator last)
|
506
|
+
{ __insert_aux2(position, first, last); }
|
507
|
+
#endif // _RWSTD_NO_MEMBER_TEMPLATES
|
508
|
+
|
509
|
+
iterator erase (iterator position)
|
510
|
+
{
|
511
|
+
if (position + 1 != end())
|
512
|
+
copy(position + 1, end(), position);
|
513
|
+
--__finish;
|
514
|
+
__value_alloc_type(__end_of_storage).destroy(__finish);
|
515
|
+
return position;
|
516
|
+
}
|
517
|
+
iterator erase (iterator first, iterator last)
|
518
|
+
{
|
519
|
+
iterator i = copy(last, end(), first);
|
520
|
+
iterator tmp = __finish;
|
521
|
+
__finish = __finish - (last - first);
|
522
|
+
__destroy(i, tmp);
|
523
|
+
return first;
|
524
|
+
}
|
525
|
+
|
526
|
+
void swap (vector<T,Allocator>& x)
|
527
|
+
{
|
528
|
+
if((allocator_type)__end_of_storage==(allocator_type)x.__end_of_storage)
|
529
|
+
{
|
530
|
+
#ifndef _RWSTD_NO_NAMESPACE
|
531
|
+
std::swap(__start, x.__start);
|
532
|
+
std::swap(__finish, x.__finish);
|
533
|
+
std::swap(__end_of_storage, x.__end_of_storage);
|
534
|
+
#else
|
535
|
+
::swap(__start, x.__start);
|
536
|
+
::swap(__finish, x.__finish);
|
537
|
+
::swap(__end_of_storage, x.__end_of_storage);
|
538
|
+
#endif // _RWSTD_NO_NAMESPACE
|
539
|
+
}
|
540
|
+
else
|
541
|
+
{
|
542
|
+
vector<T,Allocator> _x = *this;
|
543
|
+
*this = x;
|
544
|
+
x=_x;
|
545
|
+
}
|
546
|
+
}
|
547
|
+
|
548
|
+
void clear()
|
549
|
+
{
|
550
|
+
erase(begin(),end());
|
551
|
+
}
|
552
|
+
|
553
|
+
#ifndef _RWSTD_STRICT_ANSI
|
554
|
+
// Non-standard function for setting buffer allocation size
|
555
|
+
size_type allocation_size() { return __buffer_size; }
|
556
|
+
size_type allocation_size(size_type new_size)
|
557
|
+
{
|
558
|
+
size_type tmp = __buffer_size;
|
559
|
+
__buffer_size = max((size_type)1,new_size);
|
560
|
+
return tmp;
|
561
|
+
}
|
562
|
+
#endif // _RWSTD_STRICT_ANSI
|
563
|
+
};
|
564
|
+
|
565
|
+
template <class T, class Allocator>
|
566
|
+
inline bool operator== (const vector<T,Allocator>& x, const vector<T,Allocator>& y)
|
567
|
+
{
|
568
|
+
return x.size() == y.size() && equal(x.begin(), x.end(), y.begin());
|
569
|
+
}
|
570
|
+
|
571
|
+
template <class T, class Allocator>
|
572
|
+
inline bool operator< (const vector<T,Allocator>& x, const vector<T,Allocator>& y)
|
573
|
+
{
|
574
|
+
return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
|
575
|
+
}
|
576
|
+
|
577
|
+
#if !defined(_RWSTD_NO_NAMESPACE) || !defined(_RWSTD_NO_PART_SPEC_OVERLOAD)
|
578
|
+
template <class T, class Allocator>
|
579
|
+
inline bool operator!= (const vector<T,Allocator>& x, const vector<T,Allocator>& y)
|
580
|
+
{
|
581
|
+
return !(x == y);
|
582
|
+
}
|
583
|
+
|
584
|
+
template <class T, class Allocator>
|
585
|
+
inline bool operator> (const vector<T,Allocator>& x, const vector<T,Allocator>& y)
|
586
|
+
{
|
587
|
+
return y < x;
|
588
|
+
}
|
589
|
+
|
590
|
+
template <class T, class Allocator>
|
591
|
+
inline bool operator>= (const vector<T,Allocator>& x, const vector<T,Allocator>& y)
|
592
|
+
{
|
593
|
+
return !(x < y);
|
594
|
+
}
|
595
|
+
|
596
|
+
template <class T, class Allocator>
|
597
|
+
inline bool operator<= (const vector<T,Allocator>& x, const vector<T,Allocator>& y)
|
598
|
+
{
|
599
|
+
return !(y < x);
|
600
|
+
}
|
601
|
+
|
602
|
+
template <class T, class Allocator>
|
603
|
+
inline void swap(vector<T,Allocator>& a, vector<T,Allocator>& b)
|
604
|
+
{
|
605
|
+
a.swap(b);
|
606
|
+
}
|
607
|
+
#endif // !defined(_RWSTD_NO_NAMESPACE) || !defined(_RWSTD_NO_PART_SPEC_OVERLOAD)
|
608
|
+
#if defined (_RWSTD_NO_TEMPLATE_REPOSITORY) && defined (__BORLANDC__) && (__TURBOC__ < 0x540)
|
609
|
+
#ifndef _RWSTD_NO_NAMESPACE
|
610
|
+
}
|
611
|
+
#endif
|
612
|
+
|
613
|
+
#include <vector.cc>
|
614
|
+
|
615
|
+
#ifndef _RWSTD_NO_NAMESPACE
|
616
|
+
namespace std {
|
617
|
+
#endif
|
618
|
+
|
619
|
+
#endif // (_RWSTD_NO_TEMPLATE_REPOSITORY) && defined (__BORLANDC__)
|
620
|
+
|
621
|
+
//
|
622
|
+
// If bool is a builtin type, we provide a vector<bool,allocator> specialization.
|
623
|
+
// We do not provide the allocator interface for this specialization.
|
624
|
+
//
|
625
|
+
#ifndef _RWSTD_NO_BOOL
|
626
|
+
|
627
|
+
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
628
|
+
|
629
|
+
template <class Allocator>
|
630
|
+
class _RWSTDExport vector<bool, Allocator >
|
631
|
+
{
|
632
|
+
|
633
|
+
#else
|
634
|
+
|
635
|
+
// Use a macro to mutate Allocator into allocator<bool>
|
636
|
+
#define Allocator allocator<bool>
|
637
|
+
|
638
|
+
_RWSTD_TEMPLATE
|
639
|
+
class _RWSTDExport vector<bool, allocator<bool> >
|
640
|
+
{
|
641
|
+
|
642
|
+
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
|
643
|
+
|
644
|
+
public:
|
645
|
+
//
|
646
|
+
// types
|
647
|
+
//
|
648
|
+
typedef Allocator allocator_type;
|
649
|
+
typedef bool value_type;
|
650
|
+
|
651
|
+
private:
|
652
|
+
#if defined ( _RWSTD_ALLOCATOR) && !defined(_HPACC_)
|
653
|
+
#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
654
|
+
typedef _TYPENAME allocator_type::template rebind<unsigned int>::other __value_alloc_type;
|
655
|
+
#else
|
656
|
+
typedef typename allocator_type::template rebind<unsigned int>::other __value_alloc_type;
|
657
|
+
#endif
|
658
|
+
#else
|
659
|
+
typedef allocator_interface<allocator_type,unsigned int> __value_alloc_type;
|
660
|
+
#endif
|
661
|
+
|
662
|
+
public:
|
663
|
+
#ifdef _RWSTD_NO_EMBEDDED_TYPEDEF
|
664
|
+
typedef allocator<bool>::size_type size_type;
|
665
|
+
typedef allocator<bool>::difference_type difference_type;
|
666
|
+
#else
|
667
|
+
#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
668
|
+
typedef allocator_type::size_type size_type;
|
669
|
+
typedef allocator_type::difference_type difference_type;
|
670
|
+
#else
|
671
|
+
typedef _TYPENAME allocator_type::size_type size_type;
|
672
|
+
typedef _TYPENAME allocator_type::difference_type difference_type;
|
673
|
+
#endif
|
674
|
+
#endif
|
675
|
+
|
676
|
+
protected:
|
677
|
+
#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
678
|
+
typedef __value_alloc_type::pointer pointer;
|
679
|
+
typedef __value_alloc_type::const_pointer const_pointer;
|
680
|
+
#else
|
681
|
+
typedef _TYPENAME __value_alloc_type::pointer pointer;
|
682
|
+
typedef _TYPENAME __value_alloc_type::const_pointer const_pointer;
|
683
|
+
#endif
|
684
|
+
|
685
|
+
public:
|
686
|
+
|
687
|
+
//
|
688
|
+
// forward declarations
|
689
|
+
//
|
690
|
+
class iterator;
|
691
|
+
class const_iterator;
|
692
|
+
|
693
|
+
//
|
694
|
+
// bit reference
|
695
|
+
//
|
696
|
+
class reference
|
697
|
+
{
|
698
|
+
friend class iterator;
|
699
|
+
friend class const_iterator;
|
700
|
+
protected:
|
701
|
+
unsigned int* p;
|
702
|
+
unsigned int mask;
|
703
|
+
reference (unsigned int* x, unsigned int y) : p(x), mask(y) {}
|
704
|
+
public:
|
705
|
+
reference () : p(0), mask(0) {}
|
706
|
+
operator bool () const { return !(!(*p & mask)); }
|
707
|
+
reference& operator= (bool x)
|
708
|
+
{
|
709
|
+
if (x)
|
710
|
+
*p |= mask;
|
711
|
+
else
|
712
|
+
*p &= ~mask;
|
713
|
+
return *this;
|
714
|
+
}
|
715
|
+
reference& operator= (const reference& x) { return *this = bool(x); }
|
716
|
+
|
717
|
+
#ifndef _RWSTD_STRICT_ANSI
|
718
|
+
bool operator== (const reference& x) const
|
719
|
+
{
|
720
|
+
return bool(*this) == bool(x);
|
721
|
+
}
|
722
|
+
bool operator< (const reference& x) const
|
723
|
+
{
|
724
|
+
#if !defined(_MSC_VER) || defined(__BORLANDC__)
|
725
|
+
return bool(*this) < bool(x);
|
726
|
+
#else
|
727
|
+
return int(*this) < int(x);
|
728
|
+
#endif
|
729
|
+
}
|
730
|
+
bool operator!= (const reference& x) const
|
731
|
+
{
|
732
|
+
return !(*this == x);
|
733
|
+
}
|
734
|
+
bool operator> (const reference& x) const
|
735
|
+
{
|
736
|
+
return x < *this;
|
737
|
+
}
|
738
|
+
bool operator>= (const reference& x) const
|
739
|
+
{
|
740
|
+
return !(*this < x);
|
741
|
+
}
|
742
|
+
bool operator<= (const reference& x) const
|
743
|
+
{
|
744
|
+
return !(*this > x);
|
745
|
+
}
|
746
|
+
#endif // _RWSTD_STRICT_ANSI
|
747
|
+
|
748
|
+
void flip () { *p ^= mask; }
|
749
|
+
};
|
750
|
+
|
751
|
+
typedef bool const_reference;
|
752
|
+
//
|
753
|
+
// Definition of our iterator.
|
754
|
+
//
|
755
|
+
class iterator : public _RW_STD::iterator<random_access_iterator_tag,
|
756
|
+
value_type, difference_type,
|
757
|
+
pointer,reference>
|
758
|
+
{
|
759
|
+
#if !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
760
|
+
//friend class vector<bool,Allocator>;
|
761
|
+
#else
|
762
|
+
friend class vector<bool,allocator<bool> >;
|
763
|
+
#endif
|
764
|
+
friend class const_iterator;
|
765
|
+
|
766
|
+
//protected:
|
767
|
+
|
768
|
+
unsigned int* p;
|
769
|
+
unsigned int offset;
|
770
|
+
|
771
|
+
void __bump_up ()
|
772
|
+
{
|
773
|
+
if (offset++ == _RWSTD_WORD_BIT - 1)
|
774
|
+
{
|
775
|
+
offset = 0; ++p;
|
776
|
+
}
|
777
|
+
}
|
778
|
+
void __bump_down ()
|
779
|
+
{
|
780
|
+
if (offset-- == 0)
|
781
|
+
{
|
782
|
+
offset = _RWSTD_WORD_BIT - 1; --p;
|
783
|
+
}
|
784
|
+
}
|
785
|
+
|
786
|
+
public:
|
787
|
+
iterator () : p(0), offset(0) {}
|
788
|
+
iterator (unsigned int* x, unsigned int y) : p(x), offset(y) {}
|
789
|
+
|
790
|
+
reference operator* () const { return reference(p, 1U << offset); }
|
791
|
+
iterator& operator++ ()
|
792
|
+
{
|
793
|
+
__bump_up(); return *this;
|
794
|
+
}
|
795
|
+
iterator operator++ (int)
|
796
|
+
{
|
797
|
+
iterator tmp = *this; __bump_up(); return tmp;
|
798
|
+
}
|
799
|
+
iterator& operator-- ()
|
800
|
+
{
|
801
|
+
__bump_down(); return *this;
|
802
|
+
}
|
803
|
+
iterator operator-- (int)
|
804
|
+
{
|
805
|
+
iterator tmp = *this; __bump_down(); return tmp;
|
806
|
+
}
|
807
|
+
iterator& operator+= (difference_type i)
|
808
|
+
{
|
809
|
+
difference_type n = i + offset;
|
810
|
+
p += n / _RWSTD_WORD_BIT;
|
811
|
+
n = n % _RWSTD_WORD_BIT;
|
812
|
+
if (n < 0)
|
813
|
+
{
|
814
|
+
offset = n + _RWSTD_WORD_BIT; --p;
|
815
|
+
}
|
816
|
+
else
|
817
|
+
offset = n;
|
818
|
+
return *this;
|
819
|
+
}
|
820
|
+
iterator& operator-= (difference_type i)
|
821
|
+
{
|
822
|
+
*this += -i; return *this;
|
823
|
+
}
|
824
|
+
iterator operator+ (difference_type i) const
|
825
|
+
{
|
826
|
+
iterator tmp = *this; return tmp += i;
|
827
|
+
}
|
828
|
+
iterator operator- (difference_type i) const
|
829
|
+
{
|
830
|
+
iterator tmp = *this; return tmp -= i;
|
831
|
+
}
|
832
|
+
difference_type operator- (iterator x) const
|
833
|
+
{
|
834
|
+
return _RWSTD_WORD_BIT * (p - x.p) + offset - x.offset;
|
835
|
+
}
|
836
|
+
reference operator[] (difference_type i)
|
837
|
+
{
|
838
|
+
return *(*this + i);
|
839
|
+
}
|
840
|
+
bool operator== (const iterator& x) const
|
841
|
+
{
|
842
|
+
return p == x.p && offset == x.offset;
|
843
|
+
}
|
844
|
+
bool operator< (const iterator& x) const
|
845
|
+
{
|
846
|
+
return p < x.p || (p == x.p && offset < x.offset);
|
847
|
+
}
|
848
|
+
bool operator!= (const iterator& x) const
|
849
|
+
{
|
850
|
+
return !(*this == x);
|
851
|
+
}
|
852
|
+
bool operator> (const iterator& x) const
|
853
|
+
{
|
854
|
+
return x < *this;
|
855
|
+
}
|
856
|
+
bool operator>= (const iterator& x) const
|
857
|
+
{
|
858
|
+
return !(*this < x);
|
859
|
+
}
|
860
|
+
bool operator<= (const iterator& x) const
|
861
|
+
{
|
862
|
+
return !(*this > x);
|
863
|
+
}
|
864
|
+
};
|
865
|
+
//
|
866
|
+
// Definition of our const_iterator.
|
867
|
+
//
|
868
|
+
class const_iterator
|
869
|
+
: public _RW_STD::iterator<random_access_iterator_tag,
|
870
|
+
value_type, difference_type,
|
871
|
+
const_pointer, const_reference>
|
872
|
+
{
|
873
|
+
#if !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
874
|
+
//friend class vector<bool,Allocator>;
|
875
|
+
#else
|
876
|
+
friend class vector<bool,allocator<bool> >;
|
877
|
+
#endif
|
878
|
+
|
879
|
+
//protected:
|
880
|
+
|
881
|
+
unsigned int* p;
|
882
|
+
unsigned int offset;
|
883
|
+
void __bump_up ()
|
884
|
+
{
|
885
|
+
if (offset++ == _RWSTD_WORD_BIT - 1)
|
886
|
+
{
|
887
|
+
offset = 0; ++p;
|
888
|
+
}
|
889
|
+
}
|
890
|
+
void __bump_down()
|
891
|
+
{
|
892
|
+
if (offset-- == 0)
|
893
|
+
{
|
894
|
+
offset = _RWSTD_WORD_BIT - 1; --p;
|
895
|
+
}
|
896
|
+
}
|
897
|
+
|
898
|
+
public:
|
899
|
+
const_iterator () : p(0), offset(0) {}
|
900
|
+
const_iterator (unsigned int* x, unsigned int y) : p(x), offset(y) {}
|
901
|
+
#if !defined(_MSC_VER) || defined(__BORLANDC__)
|
902
|
+
#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
903
|
+
const_iterator (const vector<bool,Allocator>::iterator& x) : p(x.p), offset(x.offset) {}
|
904
|
+
#else
|
905
|
+
const_iterator (const _TYPENAME vector<bool,Allocator>::iterator& x) : p(x.p), offset(x.offset) {}
|
906
|
+
#endif
|
907
|
+
#else
|
908
|
+
const_iterator (const iterator& x) : p(x.p), offset(x.offset) {}
|
909
|
+
#endif
|
910
|
+
const_reference operator* () const
|
911
|
+
{
|
912
|
+
return vector<bool,Allocator>::reference(p, 1U << offset);
|
913
|
+
}
|
914
|
+
const_iterator& operator++ ()
|
915
|
+
{
|
916
|
+
__bump_up(); return *this;
|
917
|
+
}
|
918
|
+
const_iterator operator++ (int)
|
919
|
+
{
|
920
|
+
const_iterator tmp = *this; __bump_up(); return tmp;
|
921
|
+
}
|
922
|
+
const_iterator& operator-- ()
|
923
|
+
{
|
924
|
+
__bump_down(); return *this;
|
925
|
+
}
|
926
|
+
const_iterator operator-- (int)
|
927
|
+
{
|
928
|
+
const_iterator tmp = *this; __bump_down(); return tmp;
|
929
|
+
}
|
930
|
+
const_iterator& operator+= (difference_type i)
|
931
|
+
{
|
932
|
+
difference_type n = i + offset;
|
933
|
+
p += n / _RWSTD_WORD_BIT;
|
934
|
+
n = n % _RWSTD_WORD_BIT;
|
935
|
+
if (n < 0)
|
936
|
+
{
|
937
|
+
offset = n + _RWSTD_WORD_BIT; --p;
|
938
|
+
}
|
939
|
+
else
|
940
|
+
offset = n;
|
941
|
+
return *this;
|
942
|
+
}
|
943
|
+
const_iterator& operator-= (difference_type i)
|
944
|
+
{
|
945
|
+
*this += -i; return *this;
|
946
|
+
}
|
947
|
+
const_iterator operator+ (difference_type i) const
|
948
|
+
{
|
949
|
+
const_iterator tmp = *this; return tmp += i;
|
950
|
+
}
|
951
|
+
const_iterator operator- (difference_type i) const
|
952
|
+
{
|
953
|
+
const_iterator tmp = *this; return tmp -= i;
|
954
|
+
}
|
955
|
+
difference_type operator- (const_iterator x) const
|
956
|
+
{
|
957
|
+
return _RWSTD_WORD_BIT * (p - x.p) + offset - x.offset;
|
958
|
+
}
|
959
|
+
const_reference operator[] (difference_type i)
|
960
|
+
{
|
961
|
+
return *(*this + i);
|
962
|
+
}
|
963
|
+
bool operator== (const const_iterator& x) const
|
964
|
+
{
|
965
|
+
return p == x.p && offset == x.offset;
|
966
|
+
}
|
967
|
+
bool operator< (const const_iterator& x) const
|
968
|
+
{
|
969
|
+
return p < x.p || (p == x.p && offset < x.offset);
|
970
|
+
}
|
971
|
+
bool operator!= (const const_iterator& x) const
|
972
|
+
{
|
973
|
+
return !(*this == x);
|
974
|
+
}
|
975
|
+
bool operator> (const const_iterator& x) const
|
976
|
+
{
|
977
|
+
return x < *this;
|
978
|
+
}
|
979
|
+
bool operator>= (const const_iterator& x) const
|
980
|
+
{
|
981
|
+
return !(*this < x);
|
982
|
+
}
|
983
|
+
bool operator<= (const const_iterator& x) const
|
984
|
+
{
|
985
|
+
return !(*this > x);
|
986
|
+
}
|
987
|
+
};
|
988
|
+
//
|
989
|
+
// types
|
990
|
+
//
|
991
|
+
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
992
|
+
typedef _RW_STD::reverse_iterator<const_iterator> const_reverse_iterator;
|
993
|
+
typedef _RW_STD::reverse_iterator<iterator> reverse_iterator;
|
994
|
+
#else
|
995
|
+
typedef _RW_STD::reverse_iterator<const_iterator,
|
996
|
+
random_access_iterator_tag, value_type,
|
997
|
+
const_reference, const_pointer, difference_type>
|
998
|
+
const_reverse_iterator;
|
999
|
+
typedef _RW_STD::reverse_iterator<iterator,
|
1000
|
+
random_access_iterator_tag, value_type,
|
1001
|
+
reference, pointer, difference_type>
|
1002
|
+
reverse_iterator;
|
1003
|
+
#endif
|
1004
|
+
|
1005
|
+
private:
|
1006
|
+
//
|
1007
|
+
// These private functions are replicas of generic algorithms.
|
1008
|
+
// We provide them here to avoid putting instantiations of
|
1009
|
+
// the generic algorithms into an archive or shared library.
|
1010
|
+
// This gives you full flexibilty in deciding where you want
|
1011
|
+
// to put particular instantiations of the generic
|
1012
|
+
// algorithms.
|
1013
|
+
//
|
1014
|
+
|
1015
|
+
void __fill (iterator first, iterator last,
|
1016
|
+
const bool& value)
|
1017
|
+
{
|
1018
|
+
while (first != last) *first++ = value;
|
1019
|
+
}
|
1020
|
+
void __fill_n (iterator first, size_type n,
|
1021
|
+
const bool& value)
|
1022
|
+
{
|
1023
|
+
while (n-- > 0) *first++ = value;
|
1024
|
+
}
|
1025
|
+
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
1026
|
+
template <class Iterator>
|
1027
|
+
iterator __copy (Iterator first, Iterator last,
|
1028
|
+
iterator result)
|
1029
|
+
{
|
1030
|
+
while (first != last) *result++ = *first++;
|
1031
|
+
return result;
|
1032
|
+
}
|
1033
|
+
template <class Iterator>
|
1034
|
+
iterator __copy_backward (Iterator first, Iterator last,
|
1035
|
+
iterator result)
|
1036
|
+
{
|
1037
|
+
while (first != last) *--result = *--last;
|
1038
|
+
return result;
|
1039
|
+
}
|
1040
|
+
#else
|
1041
|
+
iterator __copy (const_iterator first, const_iterator last,
|
1042
|
+
iterator result)
|
1043
|
+
{
|
1044
|
+
while (first != last) *result++ = *first++;
|
1045
|
+
return result;
|
1046
|
+
}
|
1047
|
+
iterator __copy (const bool* first, const bool* last,
|
1048
|
+
iterator result)
|
1049
|
+
{
|
1050
|
+
while (first != last) *result++ = *first++;
|
1051
|
+
return result;
|
1052
|
+
}
|
1053
|
+
iterator __copy_backward (const_iterator first, const_iterator last,
|
1054
|
+
iterator result)
|
1055
|
+
{
|
1056
|
+
while (first != last) *--result = *--last;
|
1057
|
+
return result;
|
1058
|
+
}
|
1059
|
+
iterator __copy_backward (const bool* first, const bool* last,
|
1060
|
+
iterator result)
|
1061
|
+
{
|
1062
|
+
while (first != last) *--result = *--last;
|
1063
|
+
return result;
|
1064
|
+
}
|
1065
|
+
#endif
|
1066
|
+
|
1067
|
+
protected:
|
1068
|
+
|
1069
|
+
iterator __start;
|
1070
|
+
iterator __finish;
|
1071
|
+
__RWSTD::__rw_basis<unsigned int*,allocator_type> __end_of_storage;
|
1072
|
+
|
1073
|
+
unsigned int* __bit_alloc (size_type n)
|
1074
|
+
{
|
1075
|
+
return __value_alloc_type(__end_of_storage).allocate((n + _RWSTD_WORD_BIT - 1)/_RWSTD_WORD_BIT,__start.p);
|
1076
|
+
}
|
1077
|
+
void __init (size_type n)
|
1078
|
+
{
|
1079
|
+
unsigned int* q = __bit_alloc(n);
|
1080
|
+
__end_of_storage = q + (n + _RWSTD_WORD_BIT - 1)/_RWSTD_WORD_BIT;
|
1081
|
+
__start = iterator(q, 0);
|
1082
|
+
__finish = __start + n;
|
1083
|
+
}
|
1084
|
+
void __insert_aux (iterator position, bool x);
|
1085
|
+
|
1086
|
+
public:
|
1087
|
+
|
1088
|
+
//
|
1089
|
+
// construct/copy/destroy
|
1090
|
+
//
|
1091
|
+
vector<bool,Allocator> (const Allocator& alloc _RWSTD_DEFAULT_ARG(Allocator()))
|
1092
|
+
: __start(iterator()), __finish(iterator()),
|
1093
|
+
__end_of_storage(0,alloc)
|
1094
|
+
{ ; }
|
1095
|
+
_EXPLICIT vector<bool,Allocator> (size_type n, bool value = bool(),
|
1096
|
+
const Allocator& alloc _RWSTD_DEFAULT_ARG(Allocator()))
|
1097
|
+
: __end_of_storage(0,alloc)
|
1098
|
+
{
|
1099
|
+
__init(n);
|
1100
|
+
unsigned int * first = __start.p;
|
1101
|
+
size_type m = (n + _RWSTD_WORD_BIT - 1)/_RWSTD_WORD_BIT;
|
1102
|
+
while (m-- > 0) *first++ = value ? ~0 : 0;
|
1103
|
+
}
|
1104
|
+
|
1105
|
+
vector<bool,Allocator> (const vector<bool,Allocator >& x)
|
1106
|
+
: __end_of_storage(0,x.get_allocator())
|
1107
|
+
{
|
1108
|
+
__init(x.size());
|
1109
|
+
__copy(x.begin(), x.end(), __start);
|
1110
|
+
}
|
1111
|
+
|
1112
|
+
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
1113
|
+
template<class InputIterator>
|
1114
|
+
vector<bool,Allocator> (InputIterator first, InputIterator last)
|
1115
|
+
: __end_of_storage(0,Allocator())
|
1116
|
+
{
|
1117
|
+
size_type n;
|
1118
|
+
__initialize(n, size_type(0));
|
1119
|
+
distance(first, last, n);
|
1120
|
+
__init(n);
|
1121
|
+
__copy(first, last, __start);
|
1122
|
+
}
|
1123
|
+
#else
|
1124
|
+
vector<bool,Allocator> (const_iterator first, const_iterator last)
|
1125
|
+
: __end_of_storage(0,Allocator())
|
1126
|
+
{
|
1127
|
+
size_type n;
|
1128
|
+
__initialize(n, size_type(0));
|
1129
|
+
distance(first, last, n);
|
1130
|
+
__init(n);
|
1131
|
+
__copy(first, last, __start);
|
1132
|
+
}
|
1133
|
+
vector<bool,Allocator> (const bool* first, const bool* last)
|
1134
|
+
: __end_of_storage(0,Allocator())
|
1135
|
+
{
|
1136
|
+
size_type n;
|
1137
|
+
__initialize(n, size_type(0));
|
1138
|
+
distance(first, last, n);
|
1139
|
+
__init(n);
|
1140
|
+
__copy(first, last, __start);
|
1141
|
+
}
|
1142
|
+
#endif
|
1143
|
+
~vector<bool,Allocator> () {
|
1144
|
+
__value_alloc_type(__end_of_storage).deallocate(__start.p,
|
1145
|
+
__end_of_storage.data()-__start.p);
|
1146
|
+
}
|
1147
|
+
vector<bool,Allocator>& operator= (const vector<bool, Allocator>& x)
|
1148
|
+
{
|
1149
|
+
if (&x == this) return *this;
|
1150
|
+
if (x.size() > capacity())
|
1151
|
+
{
|
1152
|
+
__value_alloc_type(__end_of_storage).deallocate(__start.p,
|
1153
|
+
__end_of_storage.data()-__start.p);
|
1154
|
+
__init(x.size());
|
1155
|
+
}
|
1156
|
+
__copy(x.begin(), x.end(), begin());
|
1157
|
+
__finish = begin() + x.size();
|
1158
|
+
return *this;
|
1159
|
+
}
|
1160
|
+
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
1161
|
+
template<class InputIterator>
|
1162
|
+
void assign (InputIterator first, InputIterator last)
|
1163
|
+
{ erase(begin(), end()); insert(begin(), first, last); }
|
1164
|
+
#else
|
1165
|
+
void assign (const_iterator first, const_iterator last)
|
1166
|
+
{ erase(begin(), end()); insert(begin(), first, last); }
|
1167
|
+
#endif
|
1168
|
+
|
1169
|
+
void assign (size_type n, const bool& t = bool())
|
1170
|
+
{ erase(begin(), end()); insert(begin(), n, t); }
|
1171
|
+
|
1172
|
+
allocator_type get_allocator() const
|
1173
|
+
{
|
1174
|
+
return (allocator_type)__end_of_storage;
|
1175
|
+
}
|
1176
|
+
|
1177
|
+
//
|
1178
|
+
// iterators
|
1179
|
+
//
|
1180
|
+
iterator begin () { return __start; }
|
1181
|
+
const_iterator begin () const
|
1182
|
+
{ return const_iterator(__start.p,__start.offset); }
|
1183
|
+
iterator end () { return __finish; }
|
1184
|
+
const_iterator end () const
|
1185
|
+
{ return const_iterator(__finish.p,__finish.offset); }
|
1186
|
+
|
1187
|
+
reverse_iterator rbegin () { return reverse_iterator(end()); }
|
1188
|
+
const_reverse_iterator rbegin () const
|
1189
|
+
{
|
1190
|
+
return const_reverse_iterator(end());
|
1191
|
+
}
|
1192
|
+
reverse_iterator rend () { return reverse_iterator(begin()); }
|
1193
|
+
const_reverse_iterator rend () const
|
1194
|
+
{
|
1195
|
+
return const_reverse_iterator(begin());
|
1196
|
+
}
|
1197
|
+
|
1198
|
+
//
|
1199
|
+
// capacity
|
1200
|
+
//
|
1201
|
+
size_type size () const { return size_type(end() - begin()); }
|
1202
|
+
size_type max_size () const { return __value_alloc_type(__end_of_storage).max_size(); }
|
1203
|
+
void resize (size_type new_size, bool c = false);
|
1204
|
+
size_type capacity () const
|
1205
|
+
{
|
1206
|
+
return size_type(const_iterator(__end_of_storage.data(), 0) - begin());
|
1207
|
+
}
|
1208
|
+
bool empty () const { return begin() == end(); }
|
1209
|
+
void reserve (size_type n)
|
1210
|
+
{
|
1211
|
+
_RWSTD_THROW(n > max_size(), length_error,
|
1212
|
+
__RWSTD::except_msg_string(__RWSTD::__rwse_InvalidSizeParam,
|
1213
|
+
"vector<bool>::reserve(size_t)",n,max_size()).msgstr());
|
1214
|
+
if (capacity() < n)
|
1215
|
+
{
|
1216
|
+
unsigned int* q = __bit_alloc(n);
|
1217
|
+
__finish = __copy(begin(), end(), iterator(q, 0));
|
1218
|
+
__value_alloc_type(__end_of_storage).deallocate(__start.p,
|
1219
|
+
__end_of_storage.data()-__start.p);
|
1220
|
+
__start = iterator(q, 0);
|
1221
|
+
__end_of_storage = q + (n + _RWSTD_WORD_BIT - 1)/_RWSTD_WORD_BIT;
|
1222
|
+
}
|
1223
|
+
}
|
1224
|
+
|
1225
|
+
//
|
1226
|
+
// element access
|
1227
|
+
//
|
1228
|
+
reference operator[] (size_type n)
|
1229
|
+
{
|
1230
|
+
#ifdef _RWSTD_BOUNDS_CHECKING
|
1231
|
+
_RWSTD_THROW(n >= size(), out_of_range,
|
1232
|
+
__RWSTD::except_msg_string(__RWSTD::rwse_OutOfRange,
|
1233
|
+
"vector<bool>::[](size_t)",n,size()).msgstr());
|
1234
|
+
#endif
|
1235
|
+
return *(begin() + n);
|
1236
|
+
}
|
1237
|
+
const_reference operator[] (size_type n) const
|
1238
|
+
{
|
1239
|
+
#ifdef _RWSTD_BOUNDS_CHECKING
|
1240
|
+
_RWSTD_THROW(n >= size(), out_of_range,
|
1241
|
+
__RWSTD::except_msg_string(__RWSTD::rwse_OutOfRange,
|
1242
|
+
"vector<bool>::[](size_t)",n,size()).msgstr());
|
1243
|
+
#endif
|
1244
|
+
return *(begin() + n);
|
1245
|
+
}
|
1246
|
+
reference at (size_type n)
|
1247
|
+
{
|
1248
|
+
_RWSTD_THROW(n >= size(), out_of_range,
|
1249
|
+
__RWSTD::except_msg_string(__RWSTD::rwse_OutOfRange,
|
1250
|
+
"vector<bool>:: at(size_t)",n,size()).msgstr());
|
1251
|
+
return *(begin() + n);
|
1252
|
+
}
|
1253
|
+
const_reference at (size_type n) const
|
1254
|
+
{
|
1255
|
+
_RWSTD_THROW(n >= size(), out_of_range,
|
1256
|
+
__RWSTD::except_msg_string( __RWSTD::rwse_OutOfRange,
|
1257
|
+
"vector<bool>:: at(size_t) const",n,size()).msgstr());
|
1258
|
+
|
1259
|
+
return *(begin() + n);
|
1260
|
+
}
|
1261
|
+
reference front () { return *begin(); }
|
1262
|
+
const_reference front () const { return *begin(); }
|
1263
|
+
reference back () { return *(end() - 1); }
|
1264
|
+
const_reference back () const { return *(end() - 1); }
|
1265
|
+
|
1266
|
+
//
|
1267
|
+
// modifiers
|
1268
|
+
//
|
1269
|
+
void push_back (const bool& x)
|
1270
|
+
{
|
1271
|
+
if (__finish.p != __end_of_storage.data())
|
1272
|
+
*__finish++ = x;
|
1273
|
+
else
|
1274
|
+
__insert_aux(end(), x);
|
1275
|
+
}
|
1276
|
+
void pop_back () { --__finish; }
|
1277
|
+
|
1278
|
+
iterator insert (iterator position, const bool& x = bool())
|
1279
|
+
{
|
1280
|
+
size_type n = position - begin();
|
1281
|
+
if (__finish.p != __end_of_storage.data() && position == end())
|
1282
|
+
*__finish++ = x;
|
1283
|
+
else
|
1284
|
+
__insert_aux(position, x);
|
1285
|
+
return begin() + n;
|
1286
|
+
}
|
1287
|
+
void insert (iterator position, size_type n, const bool& x);
|
1288
|
+
|
1289
|
+
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
|
1290
|
+
template<class InputIterator>
|
1291
|
+
void insert (iterator position, InputIterator first, InputIterator last);
|
1292
|
+
#else
|
1293
|
+
void insert (iterator position, const_iterator first,
|
1294
|
+
const_iterator last);
|
1295
|
+
#endif
|
1296
|
+
|
1297
|
+
iterator erase (iterator position)
|
1298
|
+
{
|
1299
|
+
if (!(position + 1 == end()))
|
1300
|
+
__copy(position + 1, end(), position);
|
1301
|
+
--__finish;
|
1302
|
+
return position;
|
1303
|
+
}
|
1304
|
+
iterator erase(iterator first, iterator last)
|
1305
|
+
{
|
1306
|
+
__finish = __copy(last, end(), first);
|
1307
|
+
return first;
|
1308
|
+
}
|
1309
|
+
void swap (vector<bool,Allocator >& x)
|
1310
|
+
{
|
1311
|
+
if((allocator_type)__end_of_storage==(allocator_type)x.__end_of_storage)
|
1312
|
+
{
|
1313
|
+
#ifndef _RWSTD_NO_NAMESPACE
|
1314
|
+
std::swap(__start, x.__start);
|
1315
|
+
std::swap(__finish, x.__finish);
|
1316
|
+
std::swap(__end_of_storage, x.__end_of_storage);
|
1317
|
+
#else
|
1318
|
+
::swap(__start, x.__start);
|
1319
|
+
::swap(__finish, x.__finish);
|
1320
|
+
::swap(__end_of_storage, x.__end_of_storage);
|
1321
|
+
#endif // _RWSTD_NO_NAMESPACE
|
1322
|
+
}
|
1323
|
+
else
|
1324
|
+
{
|
1325
|
+
vector<bool,Allocator> _x = *this;
|
1326
|
+
*this = x;
|
1327
|
+
x=_x;
|
1328
|
+
}
|
1329
|
+
}
|
1330
|
+
static void swap(reference x, reference y);
|
1331
|
+
void flip ();
|
1332
|
+
void clear()
|
1333
|
+
{
|
1334
|
+
erase(begin(),end());
|
1335
|
+
}
|
1336
|
+
};
|
1337
|
+
|
1338
|
+
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
1339
|
+
template <class Allocator>
|
1340
|
+
#endif
|
1341
|
+
inline bool operator== (const vector<bool,Allocator >& x,
|
1342
|
+
const vector<bool,Allocator >& y)
|
1343
|
+
{
|
1344
|
+
if (x.size() == y.size())
|
1345
|
+
{
|
1346
|
+
#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
1347
|
+
vector<bool,Allocator >::const_iterator first1 = x.begin(),
|
1348
|
+
#else
|
1349
|
+
_TYPENAME vector<bool,Allocator >::const_iterator first1 = x.begin(),
|
1350
|
+
#endif
|
1351
|
+
last1 =x.end(),
|
1352
|
+
first2 = y.begin();
|
1353
|
+
|
1354
|
+
while (first1 != last1 && *first1 == *first2)
|
1355
|
+
{
|
1356
|
+
++first1;
|
1357
|
+
++first2;
|
1358
|
+
}
|
1359
|
+
return first1 == last1;
|
1360
|
+
}
|
1361
|
+
return false;
|
1362
|
+
}
|
1363
|
+
|
1364
|
+
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
1365
|
+
template <class Allocator>
|
1366
|
+
#endif
|
1367
|
+
inline bool operator< (const vector<bool,Allocator >& x,
|
1368
|
+
const vector<bool,Allocator >& y)
|
1369
|
+
{
|
1370
|
+
#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
1371
|
+
vector<bool,Allocator >::const_iterator first1 = x.begin(),
|
1372
|
+
#else
|
1373
|
+
_TYPENAME vector<bool,Allocator >::const_iterator first1 = x.begin(),
|
1374
|
+
#endif
|
1375
|
+
last1 =x.end(),
|
1376
|
+
first2 = y.begin(),
|
1377
|
+
last2 = y.end();
|
1378
|
+
|
1379
|
+
while (first1 != last1 && first2 != last2)
|
1380
|
+
{
|
1381
|
+
if ((int)*first1 < (int)*first2) return true;
|
1382
|
+
if ((int)*first2++ < (int)*first1++) return false;
|
1383
|
+
}
|
1384
|
+
return first1 == last1 && first2 != last2;
|
1385
|
+
}
|
1386
|
+
|
1387
|
+
#if !defined(_RWSTD_NO_NAMESPACE) || !defined(_RWSTD_NO_PART_SPEC_OVERLOAD)
|
1388
|
+
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
1389
|
+
template <class Allocator>
|
1390
|
+
#endif
|
1391
|
+
inline bool operator!= (const vector<bool,Allocator >& x,
|
1392
|
+
const vector<bool,Allocator >& y)
|
1393
|
+
{
|
1394
|
+
return !(x == y);
|
1395
|
+
}
|
1396
|
+
|
1397
|
+
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
1398
|
+
template <class Allocator>
|
1399
|
+
#endif
|
1400
|
+
inline bool operator> (const vector<bool,Allocator >& x,
|
1401
|
+
const vector<bool,Allocator >& y)
|
1402
|
+
{
|
1403
|
+
return y < x;
|
1404
|
+
}
|
1405
|
+
|
1406
|
+
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
1407
|
+
template <class Allocator>
|
1408
|
+
#endif
|
1409
|
+
inline bool operator>= (const vector<bool,Allocator >& x,
|
1410
|
+
const vector<bool,Allocator >& y)
|
1411
|
+
{
|
1412
|
+
return !(x < y);
|
1413
|
+
}
|
1414
|
+
|
1415
|
+
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
1416
|
+
template <class Allocator>
|
1417
|
+
#endif
|
1418
|
+
inline bool operator<= (const vector<bool,Allocator >& x,
|
1419
|
+
const vector<bool,Allocator >& y)
|
1420
|
+
{
|
1421
|
+
return !(y < x);
|
1422
|
+
}
|
1423
|
+
|
1424
|
+
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
1425
|
+
template <class Allocator>
|
1426
|
+
#endif
|
1427
|
+
inline void swap(vector<bool,Allocator >& a, vector<bool,Allocator >& b)
|
1428
|
+
{
|
1429
|
+
a.swap(b);
|
1430
|
+
}
|
1431
|
+
|
1432
|
+
#endif
|
1433
|
+
|
1434
|
+
#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
|
1435
|
+
#undef Allocator
|
1436
|
+
#endif
|
1437
|
+
|
1438
|
+
#endif /*_RWSTD_NO_BOOL*/
|
1439
|
+
|
1440
|
+
#ifndef _RWSTD_NO_NAMESPACE
|
1441
|
+
}
|
1442
|
+
#endif
|
1443
|
+
|
1444
|
+
#if defined (_RWSTD_NO_TEMPLATE_REPOSITORY) && (!defined (__TURBOC__) || (__TURBOC__ > 0x530))
|
1445
|
+
#include <vector.cc>
|
1446
|
+
#endif
|
1447
|
+
|
1448
|
+
#undef vector
|
1449
|
+
|
1450
|
+
#endif /*__STD_VECTOR__*/
|
1451
|
+
|
1452
|
+
#ifndef __USING_STD_NAMES__
|
1453
|
+
using namespace std;
|
1454
|
+
#endif
|
1455
|
+
|
1456
|
+
#pragma option pop
|
1457
|
+
#endif /* __VECTOR_H */
|